- attempt to shutdown sdl in a more controlled way

This commit is contained in:
Mark Vejvoda 2011-02-12 08:05:18 +00:00
parent cc973f3427
commit c1ee5df801
4 changed files with 22 additions and 8 deletions

View File

@ -149,6 +149,7 @@ Renderer::Renderer() {
this->allowRenderUnitTitles = false; this->allowRenderUnitTitles = false;
this->menu = NULL; this->menu = NULL;
this->game = NULL; this->game = NULL;
list2d = 0;
showDebugUI = false; showDebugUI = false;
showDebugUILevel = debugui_fps; showDebugUILevel = debugui_fps;
modelRenderer = NULL; modelRenderer = NULL;
@ -445,13 +446,24 @@ void Renderer::end() {
mapSurfaceData.clear(); mapSurfaceData.clear();
//delete resources //delete resources
modelManager[rsGlobal]->end(); if(modelManager[rsGlobal]) {
textureManager[rsGlobal]->end(); modelManager[rsGlobal]->end();
fontManager[rsGlobal]->end(); }
particleManager[rsGlobal]->end(); if(textureManager[rsGlobal]) {
textureManager[rsGlobal]->end();
}
if(fontManager[rsGlobal]) {
fontManager[rsGlobal]->end();
}
if(particleManager[rsGlobal]) {
particleManager[rsGlobal]->end();
}
//delete 2d list //delete 2d list
glDeleteLists(list2d, 1); if(list2d > 0) {
glDeleteLists(list2d, 1);
list2d = 0;
}
} }
void Renderer::endGame() { void Renderer::endGame() {

View File

@ -168,6 +168,7 @@ void fatal(const char *s, ...) // failure exit
program = NULL; program = NULL;
// END // END
SDL_Quit();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -413,6 +414,7 @@ public:
//printf("In [%s::%s Line: %d] [%s] gameInitialized = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,gameInitialized); //printf("In [%s::%s Line: %d] [%s] gameInitialized = %d\n",__FILE__,__FUNCTION__,__LINE__,msg,gameInitialized);
cleanupProcessObjects(); cleanupProcessObjects();
SDL_Quit();
exit(-1); exit(-1);
} }
@ -437,6 +439,7 @@ public:
// END // END
cleanupProcessObjects(); cleanupProcessObjects();
SDL_Quit();
exit(-1); exit(-1);
} }
@ -1814,8 +1817,8 @@ __try {
#endif #endif
int result = glestMain(argc, argv); int result = glestMain(argc, argv);
cleanupProcessObjects(); cleanupProcessObjects();
SDL_Quit();
return result; return result;
#ifdef WIN32_STACK_TRACE #ifdef WIN32_STACK_TRACE

View File

@ -21,7 +21,6 @@
std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n"; \ std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n"; \
return 1; \ return 1; \
} \ } \
atexit(SDL_Quit); \
SDL_EnableUNICODE(1); \ SDL_EnableUNICODE(1); \
int result = X(argc, argv); \ int result = X(argc, argv); \
return result; \ return result; \

View File

@ -61,7 +61,7 @@ void ModelRendererGl::begin(bool renderNormals, bool renderTextures, bool render
glEnable(GL_POLYGON_OFFSET_FILL); glEnable(GL_POLYGON_OFFSET_FILL);
//glEnable(GL_POLYGON_OFFSET_LINE); //glEnable(GL_POLYGON_OFFSET_LINE);
//glEnable(GL_POLYGON_OFFSET_POINT); //glEnable(GL_POLYGON_OFFSET_POINT);
glPolygonOffset(1.0f, 1.0f); glPolygonOffset(0.005f, 0.0f);
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);