- case DRAWQUEUE_STRING:
- str = (char *)(dq + 1);
- if (strcmp("gfx/conchars", currentpic))
- {
- if (batch)
- {
- batch = false;
- qglEnd();
- }
- currentpic = "gfx/conchars";
- qglBindTexture(GL_TEXTURE_2D, chartexnum);
- }
- if (!batch)
- {
- batch = true;
- qglBegin(GL_TRIANGLES);
- batchcount = 0;
- }
- while ((num = *str++) && x < vid.conwidth)
- {
- if (num != ' ')
- {
- s = (num & 15)*0.0625f + (0.5f / 256.0f);
- t = (num >> 4)*0.0625f + (0.5f / 256.0f);
- u = 0.0625f - (1.0f / 256.0f);
- v = 0.0625f - (1.0f / 256.0f);
- qglTexCoord2f (s , t );qglVertex2f (x , y );
- qglTexCoord2f (s+u, t );qglVertex2f (x+w, y );
- qglTexCoord2f (s+u, t+v);qglVertex2f (x+w, y+h);
- qglTexCoord2f (s , t );qglVertex2f (x , y );
- qglTexCoord2f (s+u, t+v);qglVertex2f (x+w, y+h);
- qglTexCoord2f (s , t+v);qglVertex2f (x , y+h);
- batchcount++;
- }
- x += w;
- }
- break;
- case DRAWQUEUE_MESH:
- if (batch)
- {
- batch = false;
- qglEnd();
- }
-
- mesh = (void *)(dq + 1);
- qglBindTexture(GL_TEXTURE_2D, R_GetTexture(mesh->texture));
- qglVertexPointer(3, GL_FLOAT, sizeof(float[4]), mesh->vertices);CHECKGLERROR
- qglTexCoordPointer(2, GL_FLOAT, sizeof(float[2]), mesh->texcoords);CHECKGLERROR
- qglColorPointer(4, GL_FLOAT, sizeof(float[4]), mesh->colors);CHECKGLERROR
- qglEnableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
- qglEnableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- qglEnableClientState(GL_COLOR_ARRAY);CHECKGLERROR
- GL_DrawRangeElements(0, mesh->numvertices, mesh->numindices, mesh->indices);
- qglDisableClientState(GL_VERTEX_ARRAY);CHECKGLERROR
- qglDisableClientState(GL_TEXTURE_COORD_ARRAY);CHECKGLERROR
- qglDisableClientState(GL_COLOR_ARRAY);CHECKGLERROR
-
- // restore color, since it got trashed by using color array
- qglColor4ub((qbyte)(((color >> 24) & 0xFF) >> overbright), (qbyte)(((color >> 16) & 0xFF) >> overbright), (qbyte)(((color >> 8) & 0xFF) >> overbright), (qbyte)(color & 0xFF));
- CHECKGLERROR
- currentpic = "\0";