Skip to content

Commit

Permalink
ref_gl: fix late studio cvars registration, enable DrawRangeElements …
Browse files Browse the repository at this point in the history
…in GLES contexts
  • Loading branch information
Dmitry Toroshchin committed Oct 5, 2023
1 parent 5f723ff commit ea4334d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 7 additions & 1 deletion ref/gl/gl_opengl.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ CVAR_DEFINE_AUTO( r_traceglow, "1", FCVAR_GLCONFIG, "cull flares behind models"
CVAR_DEFINE_AUTO( gl_round_down, "2", FCVAR_GLCONFIG|FCVAR_READ_ONLY, "round texture sizes to nearest POT value" );
CVAR_DEFINE( r_vbo, "gl_vbo", "0", FCVAR_ARCHIVE, "draw world using VBO (known to be glitchy)" );
CVAR_DEFINE( r_vbo_dlightmode, "gl_vbo_dlightmode", "1", FCVAR_ARCHIVE, "vbo dlight rendering mode (0-1)" );
extern convar_t r_studio_drawelements;
extern convar_t r_studio_sort_textures;

DEFINE_ENGINE_SHARED_CVAR_LIST()

Expand Down Expand Up @@ -720,6 +722,9 @@ void GL_InitExtensionsGLES( void )
case GL_ARB_VERTEX_ARRAY_OBJECT_EXT:
GL_CheckExtension( "vertex_array_object", vaofuncs, "gl_vertex_array_object", extid );
break;
case GL_DRAW_RANGEELEMENTS_EXT:
GL_CheckExtension( "draw_range_elements", drawrangeelementsfuncs, "gl_drawrangeelements", extid );
break;
#endif
case GL_DEBUG_OUTPUT:
if( glw_state.extended )
Expand Down Expand Up @@ -1010,7 +1015,8 @@ void GL_InitCommands( void )
gEngfuncs.Cvar_RegisterVariable( &gl_msaa );
gEngfuncs.Cvar_RegisterVariable( &gl_stencilbits );
gEngfuncs.Cvar_RegisterVariable( &gl_round_down );

gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
gEngfuncs.Cvar_RegisterVariable( &r_studio_drawelements );
// these cvar not used by engine but some mods requires this
gEngfuncs.Cvar_RegisterVariable( &gl_polyoffset );

Expand Down
6 changes: 2 additions & 4 deletions ref/gl/gl_studio.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ typedef struct
} studio_draw_state_t;

// studio-related cvars
static CVAR_DEFINE_AUTO( r_studio_sort_textures, "0", FCVAR_GLCONFIG, "change draw order for additive meshes" );
CVAR_DEFINE_AUTO( r_studio_sort_textures, "0", FCVAR_GLCONFIG, "change draw order for additive meshes" );
static cvar_t *cl_righthand = NULL;
static CVAR_DEFINE_AUTO( r_studio_drawelements, "1", FCVAR_GLCONFIG, "use glDrawElements for studiomodels" );
CVAR_DEFINE_AUTO( r_studio_drawelements, "1", FCVAR_GLCONFIG, "use glDrawElements for studiomodels" );

static r_studio_interface_t *pStudioDraw;
static studio_draw_state_t g_studio; // global studio state
Expand All @@ -146,8 +146,6 @@ R_StudioInit
*/
void R_StudioInit( void )
{
gEngfuncs.Cvar_RegisterVariable( &r_studio_sort_textures );
gEngfuncs.Cvar_RegisterVariable( &r_studio_drawelements );

#if XASH_PSVITA
// don't do the same array-building work twice since that's what our FFP shim does anyway
Expand Down

0 comments on commit ea4334d

Please sign in to comment.