]> git.jsancho.org Git - lugaru.git/blobdiff - Source/OpenGL_Windows.cpp
Some debug about textures.
[lugaru.git] / Source / OpenGL_Windows.cpp
index a9edfb56952e54b6a068342e2d366fe18e99fea0..5a5b0f10bc7b8481649b32633c44ef89bc31931c 100644 (file)
@@ -237,21 +237,25 @@ void initGL(){
 }
 
 static void toggleFullscreen(){
-       SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
-    //~ SDL_Surface* screen=SDL_GetVideoSurface();
-    //~ Uint32 flags=screen->flags;
-    //~ screen=SDL_SetVideoMode(0,0,0,flags^SDL_FULLSCREEN);
-    //~ if(!screen)
-        //~ screen=SDL_SetVideoMode(0,0,0,flags);
-    //~ if(!screen)
-        //~ exit(1);
-    //~ //reload opengl state
-    //~ initGL();
-    //~ for(std::vector<TextureInfo>::iterator it=Game::textures.begin(); it!=Game::textures.end(); it++) {
-        //~ it->load();
-    //~ }
-    //~ pgame->text.BuildFont();
-    //~ pgame->LoadScreenTexture();
+       if(!SDL_WM_ToggleFullScreen(SDL_GetVideoSurface())){
+        SDL_Surface* screen=SDL_GetVideoSurface();
+        Uint32 flags=screen->flags;
+        screen=SDL_SetVideoMode(0,0,0,flags^SDL_FULLSCREEN);
+        if(!screen)
+            screen=SDL_SetVideoMode(0,0,0,flags);
+        if(!screen)
+            exit(1);
+        //reload opengl state
+        initGL();
+        Texture::reloadAll();
+        if(text)
+            text->BuildFont();
+        if(firstload){
+            screentexture=0;
+            LoadScreenTexture();
+        }
+        screentexture2=0;
+    }
 }
 
 static void sdlEventProc(const SDL_Event &e)
@@ -549,7 +553,12 @@ void DoUpdate ()
                num_channels = 0;
        }
 */
-       DrawGL();
+       if ( stereomode == stereoNone ) {
+               DrawGLScene(stereoCenter);
+       } else {
+               DrawGLScene(stereoLeft);
+               DrawGLScene(stereoRight);
+       }
 }
 
 // --------------------------------------------------------------------------
@@ -707,7 +716,7 @@ int main(int argc, char **argv)
                        if (!SetUp ())
                 return 42;
 
-                       while (!gDone&&!quit&&(!tryquit))
+                       while (!gDone&&!tryquit)
                        {
                                        if (IsFocused())
                                        {
@@ -887,8 +896,10 @@ static bool load_png(const char *file_name, TGAImageRec &tex)
     png_byte **row_pointers = NULL;
     FILE *fp = fopen(file_name, "rb");
 
-    if (fp == NULL)
+    if (fp == NULL) {
+               cerr << file_name << " not found" << endl;
         return(NULL);
+       }
 
     png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
     if (png_ptr == NULL)
@@ -952,8 +963,11 @@ static bool load_png(const char *file_name, TGAImageRec &tex)
     tex.sizeY = height;
     tex.bpp = 32;
     retval = true;
-
+    
 png_done:
+       if(!retval) {
+               cerr << "There was a problem loading " << file_name << endl;
+       }
     png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
     if (fp)
         fclose(fp);