1
0
Fork 0

Avoid calling R_SetColorMappings() too early

Simplified window shutdown on win32
This commit is contained in:
Eugene 2021-12-09 14:08:11 +02:00
parent 43f737051f
commit b6e44359cb
7 changed files with 20 additions and 2 deletions

View File

@ -1354,6 +1354,11 @@ void R_SetColorMappings( void ) {
int shift;
qboolean applyGamma;
if ( !tr.inited ) {
// it may be called from window handling functions where gamma flags is now yet known/set
return;
}
// setup the overbright lighting
// negative value will force gamma in windowed mode
tr.overbrightBits = abs( r_overBrightBits->integer );

View File

@ -643,6 +643,8 @@ static void InitOpenGL( void )
// set default state
GL_SetDefaultState();
tr.inited = qtrue;
}
@ -1795,6 +1797,7 @@ static void RE_Shutdown( refShutdownCode_t code ) {
ri.FreeAll();
tr.registered = qfalse;
tr.inited = qfalse;
}

View File

@ -1067,6 +1067,7 @@ typedef struct {
*/
typedef struct {
qboolean registered; // cleared at shutdown, set at beginRegistration
qboolean inited; // cleared at shutdown, set at InitOpenGL
int visCount; // incremented every time a new vis cluster is entered
int frameCount; // incremented every frame

View File

@ -1681,6 +1681,11 @@ void R_SetColorMappings( void ) {
int shift;
qboolean applyGamma;
if ( !tr.inited ) {
// it may be called from window handling functions where gamma flags is now yet known/set
return;
}
// setup the overbright lighting
// negative value will force gamma in windowed mode
tr.overbrightBits = abs( r_overBrightBits->integer );

View File

@ -598,6 +598,8 @@ static void InitOpenGL( void )
// set default state
GL_SetDefaultState();
tr.inited = qtrue;
}
@ -1869,6 +1871,7 @@ static void RE_Shutdown( refShutdownCode_t code ) {
ri.FreeAll();
tr.registered = qfalse;
tr.inited = qfalse;
}

View File

@ -1144,6 +1144,7 @@ typedef struct drawSurfsCommand_s drawSurfsCommand_t;
*/
typedef struct {
qboolean registered; // cleared at shutdown, set at beginRegistration
qboolean inited; // cleared at shutdown, set at InitOpenGL
int visCount; // incremented every time a new vis cluster is entered
int frameCount; // incremented every frame

View File

@ -1428,7 +1428,7 @@ void GLimp_Shutdown( qboolean unloadDLL )
if ( g_wv.hWnd )
{
Com_Printf( "...destroying window\n" );
ShowWindow( g_wv.hWnd, SW_HIDE );
//ShowWindow( g_wv.hWnd, SW_HIDE );
DestroyWindow( g_wv.hWnd );
g_wv.hWnd = NULL;
glw_state.pixelFormatSet = qfalse;
@ -1535,7 +1535,7 @@ void VKimp_Shutdown( qboolean unloadDLL )
if ( g_wv.hWnd )
{
Com_Printf( "...destroying window\n" );
ShowWindow( g_wv.hWnd, SW_HIDE );
//ShowWindow( g_wv.hWnd, SW_HIDE );
DestroyWindow( g_wv.hWnd );
g_wv.hWnd = NULL;
}