X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FOpenGL_Windows.cpp;h=5a5b0f10bc7b8481649b32633c44ef89bc31931c;hb=253b1aa9cfce1e8b1fc12b74d96a7808f615d783;hp=a9edfb56952e54b6a068342e2d366fe18e99fea0;hpb=c44a844d9305c4f1f7dd0479e4a3af3e90b96a1b;p=lugaru.git diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index a9edfb5..5a5b0f1 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -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::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);