- if (gl_mesh_drawmode.integer >= 3/* && (mesh->numvertices) <= gl_maxdrawrangeelementsvertices && (mesh->numindices) <= gl_maxdrawrangeelementsindices*/)
- {
- // GL 1.2 or GL 1.1 with extension
- GL_LockArray(0, mesh->numvertices);
- qglDrawRangeElements(GL_TRIANGLES, 0, mesh->numvertices, mesh->numindices, GL_UNSIGNED_INT, mesh->indices);
- CHECKGLERROR
- GL_UnlockArray();
- }
- else if (gl_mesh_drawmode.integer >= 2)
- {
- // GL 1.1
- GL_LockArray(0, mesh->numvertices);
- qglDrawElements(GL_TRIANGLES, mesh->numindices, GL_UNSIGNED_INT, mesh->indices);
- CHECKGLERROR
- GL_UnlockArray();
- }
- else if (gl_mesh_drawmode.integer >= 1)
- {
- int i;
- // GL 1.1
- // feed it manually using glArrayElement
- GL_LockArray(0, mesh->numvertices);
- qglBegin(GL_TRIANGLES);
- for (i = 0;i < mesh->numindices;i++)
- qglArrayElement(mesh->indices[i]);
- qglEnd();
- CHECKGLERROR
- GL_UnlockArray();
- }
- else
- {
- int i, in;
- // GL 1.1 but not using vertex arrays - 3dfx glquake minigl driver
- // feed it manually
- qglBegin(GL_TRIANGLES);
- for (i = 0;i < mesh->numindices;i++)
- {
- in = mesh->indices[i];
- qglColor4ub(mesh->colors[in * 4], mesh->colors[in * 4 + 1], mesh->colors[in * 4 + 2], mesh->colors[in * 4 + 3]);
- qglTexCoord2f(mesh->texcoords[in * 2], mesh->texcoords[in * 2 + 1]);
- qglVertex3f(mesh->vertices[in * 3], mesh->vertices[in * 3 + 1], mesh->vertices[in * 3 + 2]);
- }
- qglEnd();
- CHECKGLERROR
- }
- if (gl_mesh_drawmode.integer > 0)
- {
- qglDisableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
- qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR