cvar_t gl_mesh_testarrayelement = {0, "gl_mesh_testarrayelement", "0", "use glBegin(GL_TRIANGLES);glArrayElement();glEnd(); primitives instead of glDrawElements (useful to test for driver bugs with glDrawElements)"};
cvar_t gl_mesh_testmanualfeeding = {0, "gl_mesh_testmanualfeeding", "0", "use glBegin(GL_TRIANGLES);glTexCoord2f();glVertex3f();glEnd(); primitives instead of glDrawElements (useful to test for driver bugs with glDrawElements)"};
cvar_t gl_mesh_prefer_short_elements = {0, "gl_mesh_prefer_short_elements", "1", "use GL_UNSIGNED_SHORT element arrays instead of GL_UNSIGNED_INT"};
-cvar_t gl_workaround_mac_texmatrix = {0, "gl_workaround_mac_texmatrix", "0", "if set to 1 this always calls glClientActiveTexture when calling glActiveTexture, to work around mistargeted texture matrix updates on Mac OSX drivers"};
cvar_t gl_paranoid = {0, "gl_paranoid", "0", "enables OpenGL error checking and other tests"};
cvar_t gl_printcheckerror = {0, "gl_printcheckerror", "0", "prints all OpenGL error checks, useful to identify location of driver crashes"};
cvar_t gl_dither = {CVAR_SAVE, "gl_dither", "1", "enables OpenGL dithering (16bit looks bad with this off)"};
cvar_t gl_lockarrays = {0, "gl_lockarrays", "0", "enables use of glLockArraysEXT, may cause glitches with some broken drivers, and may be slower than normal"};
cvar_t gl_lockarrays_minimumvertices = {0, "gl_lockarrays_minimumvertices", "1", "minimum number of vertices required for use of glLockArraysEXT, setting this too low may reduce performance"};
-cvar_t gl_vbo = {CVAR_SAVE, "gl_vbo", "1", "make use of GL_ARB_vertex_buffer_object extension to store static geometry in video memory for faster rendering"};
+cvar_t gl_vbo = {CVAR_SAVE, "gl_vbo", "3", "make use of GL_ARB_vertex_buffer_object extension to store static geometry in video memory for faster rendering, 0 disables VBO allocation or use, 1 enables VBOs for vertex and triangle data, 2 only for vertex data, 3 for vertex data and triangle data of simple meshes (ones with only one surface)"};
cvar_t v_flipped = {0, "v_flipped", "0", "mirror the screen (poor man's left handed mode)"};
qboolean v_flipped_state = false;
Cvar_RegisterVariable(&gl_vbo);
Cvar_RegisterVariable(&gl_paranoid);
Cvar_RegisterVariable(&gl_printcheckerror);
- Cvar_RegisterVariable(&gl_workaround_mac_texmatrix);
#ifdef NORENDER
Cvar_SetValue("r_render", 0);
#endif
for (i = 0;i < backendunits;i++)
{
GL_ActiveTexture(i);
- if (gl_workaround_mac_texmatrix.integer)
- GL_ClientActiveTexture(i);
qglDisable(GL_TEXTURE_1D);CHECKGLERROR
qglDisable(GL_TEXTURE_2D);CHECKGLERROR
if (gl_texture3d)
unsigned int numelements = numtriangles * 3;
if (numvertices < 3 || numtriangles < 1)
{
- Con_Printf("R_Mesh_Draw(%d, %d, %d, %d, %8p, %8p, %i, %i);\n", firstvertex, numvertices, firsttriangle, numtriangles, element3i, element3s, bufferobject3i, bufferobject3s);
+ if (numvertices < 0 || numtriangles < 0 || developer.integer >= 100)
+ Con_Printf("R_Mesh_Draw(%d, %d, %d, %d, %8p, %8p, %i, %i);\n", firstvertex, numvertices, firsttriangle, numtriangles, element3i, element3s, bufferobject3i, bufferobject3s);
return;
}
if (!gl_mesh_prefer_short_elements.integer)
}
qglBufferDataARB(target, size, data, GL_STATIC_DRAW_ARB);
- info = Mem_ExpandableArray_AllocRecord(&gl_bufferobjectinfoarray);
+ info = (gl_bufferobjectinfo_t *) Mem_ExpandableArray_AllocRecord(&gl_bufferobjectinfoarray);
memset(info, 0, sizeof(*info));
info->target = target;
info->object = bufferobject;
endindex = Mem_ExpandableArray_IndexRange(&gl_bufferobjectinfoarray);
for (i = 0;i < endindex;i++)
{
- info = Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i);
+ info = (gl_bufferobjectinfo_t *) Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i);
if (!info)
continue;
if (info->object == bufferobject)
endindex = Mem_ExpandableArray_IndexRange(&gl_bufferobjectinfoarray);
for (i = 0;i < endindex;i++)
{
- info = Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i);
+ info = (gl_bufferobjectinfo_t *) Mem_ExpandableArray_RecordAtIndex(&gl_bufferobjectinfoarray, i);
if (!info)
continue;
switch(info->target)
CHECKGLERROR
Matrix4x4_ToArrayDoubleGL(&unit->matrix, glmatrix);
GL_ActiveTexture(unitnum);
- if (gl_workaround_mac_texmatrix.integer)
- GL_ClientActiveTexture(unitnum);
qglMatrixMode(GL_TEXTURE);CHECKGLERROR
qglLoadMatrixd(glmatrix);CHECKGLERROR
qglMatrixMode(GL_MODELVIEW);CHECKGLERROR
unit->matrix = identitymatrix;
CHECKGLERROR
GL_ActiveTexture(unitnum);
- if (gl_workaround_mac_texmatrix.integer)
- GL_ClientActiveTexture(unitnum);
qglMatrixMode(GL_TEXTURE);CHECKGLERROR
qglLoadIdentity();CHECKGLERROR
qglMatrixMode(GL_MODELVIEW);CHECKGLERROR
unit->matrix = identitymatrix;
CHECKGLERROR
GL_ActiveTexture(unitnum);
- if (gl_workaround_mac_texmatrix.integer)
- GL_ClientActiveTexture(unitnum);
qglMatrixMode(GL_TEXTURE);CHECKGLERROR
qglLoadIdentity();CHECKGLERROR
qglMatrixMode(GL_MODELVIEW);CHECKGLERROR