diff --git a/engine/ref_api.h b/engine/ref_api.h index 2566c2fb..778bcf4b 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -106,6 +106,8 @@ typedef struct ref_globals_s sortedface_t *draw_surfaces; // used for sorting translucent surfaces int max_surfaces; // max surfaces per submodel (for all models) size_t visbytes; // cluster size + + int desktopBitsPixel; } ref_globals_t; enum diff --git a/ref_gl/gl_image.c b/ref_gl/gl_image.c index 59ed1912..eb8b7a0b 100644 --- a/ref_gl/gl_image.c +++ b/ref_gl/gl_image.c @@ -687,25 +687,25 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan { if( haveColor && haveAlpha ) { - if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 ) + if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 ) tex->format = GL_RGBA16F_ARB; else tex->format = GL_RGBA32F_ARB; } else if( haveColor ) { - if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 ) + if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 ) tex->format = GL_RGB16F_ARB; else tex->format = GL_RGB32F_ARB; } else if( haveAlpha ) { - if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 ) + if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 ) tex->format = GL_RG16F; else tex->format = GL_RG32F; } else { - if( FBitSet( tex->flags, TF_ARB_16BIT ) || glw_state.desktopBitsPixel == 16 ) + if( FBitSet( tex->flags, TF_ARB_16BIT ) || gpGlobals->desktopBitsPixel == 16 ) tex->format = GL_LUMINANCE16F_ARB; else tex->format = GL_LUMINANCE32F_ARB; } @@ -713,7 +713,7 @@ static void GL_SetTextureFormat( gl_texture_t *tex, pixformat_t format, int chan else { // NOTE: not all the types will be compressed - int bits = glw_state.desktopBitsPixel; + int bits = gpGlobals->desktopBitsPixel; switch( GL_CalcTextureSamples( channelMask )) { diff --git a/ref_gl/gl_local.h b/ref_gl/gl_local.h index b9ca8679..ace58f8c 100644 --- a/ref_gl/gl_local.h +++ b/ref_gl/gl_local.h @@ -691,13 +691,6 @@ typedef struct typedef struct { - void* context; // handle to GL rendering context - int safe; - - int desktopBitsPixel; - int desktopWidth; - int desktopHeight; - qboolean initialized; // OpenGL subsystem started qboolean extended; // extended context allows to GL_Debug } glwstate_t; diff --git a/ref_gl/gl_opengl.c b/ref_gl/gl_opengl.c index 68d8951a..6f1725d7 100644 --- a/ref_gl/gl_opengl.c +++ b/ref_gl/gl_opengl.c @@ -1041,7 +1041,7 @@ void GL_SetupAttributes( int safegl ) if( safegl < SAFE_NOACC ) gEngfuncs.GL_SetAttribute( REF_GL_ACCELERATED_VISUAL, 1 ); - gEngfuncs.Con_Printf( "bpp %d\n", glw_state.desktopBitsPixel ); + gEngfuncs.Con_Printf( "bpp %d\n", gpGlobals->desktopBitsPixel ); if( safegl < SAFE_NOSTENCIL ) gEngfuncs.GL_SetAttribute( REF_GL_STENCIL_SIZE, gl_stencilbits->value ); @@ -1056,13 +1056,13 @@ void GL_SetupAttributes( int safegl ) if( safegl < SAFE_NOCOLOR ) { - if( glw_state.desktopBitsPixel >= 24 ) + if( gpGlobals->desktopBitsPixel >= 24 ) { gEngfuncs.GL_SetAttribute( REF_GL_RED_SIZE, 8 ); gEngfuncs.GL_SetAttribute( REF_GL_GREEN_SIZE, 8 ); gEngfuncs.GL_SetAttribute( REF_GL_BLUE_SIZE, 8 ); } - else if( glw_state.desktopBitsPixel >= 16 ) + else if( gpGlobals->desktopBitsPixel >= 16 ) { gEngfuncs.GL_SetAttribute( REF_GL_RED_SIZE, 5 ); gEngfuncs.GL_SetAttribute( REF_GL_GREEN_SIZE, 6 );