Browse Source

ref_gl: init r_temppool before InitExtensions, fix extension string allocation

pull/2/head
mittorn 9 months ago committed by Alibek Omarov
parent
commit
c7dd9d6437
  1. 7
      ref/gl/gl_opengl.c

7
ref/gl/gl_opengl.c

@ -982,7 +982,7 @@ void GL_InitExtensions( void )
char *str; char *str;
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
len += Q_strlen((const char*)pglGetStringi(GL_EXTENSIONS, i)) + 1; len += Q_strlen((const char*)pglGetStringi(GL_EXTENSIONS, i)) + 1;
str = (char*)Mem_Calloc( 1, len ); str = (char*)Mem_Calloc( r_temppool, len );
glConfig.extensions_string = str; glConfig.extensions_string = str;
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
{ {
@ -1162,6 +1162,8 @@ qboolean R_Init( void )
GL_SetDefaultState(); GL_SetDefaultState();
r_temppool = Mem_AllocPool( "Render Zone" );
// create the window and set up the context // create the window and set up the context
if( !gEngfuncs.R_Init_Video( REF_GL )) // request GL context if( !gEngfuncs.R_Init_Video( REF_GL )) // request GL context
{ {
@ -1169,11 +1171,10 @@ qboolean R_Init( void )
gEngfuncs.R_Free_Video(); gEngfuncs.R_Free_Video();
// Why? Host_Error again??? // Why? Host_Error again???
// gEngfuncs.Host_Error( "Can't initialize video subsystem\nProbably driver was not installed" ); // gEngfuncs.Host_Error( "Can't initialize video subsystem\nProbably driver was not installed" );
Mem_FreePool( &r_temppool );
return false; return false;
} }
r_temppool = Mem_AllocPool( "Render Zone" );
GL_SetDefaults(); GL_SetDefaults();
R_CheckVBO(); R_CheckVBO();
R_InitImages(); R_InitImages();

Loading…
Cancel
Save