+ dq = (drawqueue_t *)(r_refdef.drawqueue + pos);
+ color = dq->color;
+
+ if(dq->flags == DRAWFLAG_ADDITIVE)
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE);
+ else if(dq->flags == DRAWFLAG_MODULATE)
+ GL_BlendFunc(GL_DST_COLOR, GL_ZERO);
+ else if(dq->flags == DRAWFLAG_2XMODULATE)
+ GL_BlendFunc(GL_DST_COLOR,GL_SRC_COLOR);
+ else
+ GL_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ GL_DepthMask(true);
+ GL_DepthTest(false);
+
+ c[0] = (float) ((color >> 24) & 0xFF) * (1.0f / 255.0f);
+ c[1] = (float) ((color >> 16) & 0xFF) * (1.0f / 255.0f);
+ c[2] = (float) ((color >> 8) & 0xFF) * (1.0f / 255.0f);
+ c[3] = (float) ( color & 0xFF) * (1.0f / 255.0f);
+ x = dq->x;
+ y = dq->y;
+ w = dq->scalex;
+ h = dq->scaley;
+
+ switch(dq->command)
+ {
+ case DRAWQUEUE_STRING:
+ GL_Color(c[0], c[1], c[2], c[3]);
+ str = (char *)(dq + 1);
+ batchcount = 0;
+ m.pointer_vertex = varray_vertex3f;
+ m.pointer_color = NULL;
+ m.pointer_texcoord[0] = varray_texcoord2f[0];
+ m.tex[0] = chartexnum;
+ R_Mesh_State(&m);
+ at = varray_texcoord2f[0];
+ av = varray_vertex3f;
+ while ((num = *str++) && x < vid_conwidth.integer)
+ {
+ 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);
+ at[ 0] = s ;at[ 1] = t ;
+ at[ 2] = s+u;at[ 3] = t ;
+ at[ 4] = s+u;at[ 5] = t+v;
+ at[ 6] = s ;at[ 7] = t+v;
+ av[ 0] = x ;av[ 1] = y ;av[ 2] = 10;
+ av[ 3] = x+w;av[ 4] = y ;av[ 5] = 10;
+ av[ 6] = x+w;av[ 7] = y+h;av[ 8] = 10;
+ av[ 9] = x ;av[10] = y+h;av[11] = 10;
+ at += 8;
+ av += 12;
+ batchcount++;
+ if (batchcount >= 128)
+ {
+ GL_LockArrays(0, batchcount * 4);
+ R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
+ GL_LockArrays(0, 0);
+ batchcount = 0;
+ at = varray_texcoord2f[0];
+ av = varray_vertex3f;
+ }
+ }
+ x += w;
+ }
+ if (batchcount > 0)
+ {
+ GL_LockArrays(0, batchcount * 4);
+ R_Mesh_Draw(0, batchcount * 4, batchcount * 2, quadelements);
+ GL_LockArrays(0, 0);
+ }
+ break;
+ case DRAWQUEUE_MESH:
+ mesh = (drawqueuemesh_t *)(dq + 1);
+ m.pointer_vertex = mesh->data_vertex3f;
+ m.pointer_color = mesh->data_color4f;
+ m.pointer_texcoord[0] = mesh->data_texcoord2f;
+ m.tex[0] = R_GetTexture(mesh->texture);
+ if (!m.tex[0])
+ m.pointer_texcoord[0] = NULL;
+ R_Mesh_State(&m);
+ GL_LockArrays(0, mesh->num_vertices);
+ R_Mesh_Draw(0, mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
+ GL_LockArrays(0, 0);
+ break;
+ case DRAWQUEUE_SETCLIP:
+ {
+ // We have to convert the con coords into real coords
+ int x , y, width, height;
+ x = dq->x * ((float)vid.width / vid_conwidth.integer);
+ // OGL uses top to bottom
+ y = dq->y * ((float) vid.height / vid_conheight.integer);
+ width = dq->scalex * ((float)vid.width / vid_conwidth.integer);
+ height = dq->scaley * ((float)vid.height / vid_conheight.integer);
+
+ GL_Scissor(x, y, width, height);
+
+ GL_ScissorTest(true);
+ }
+ break;
+ case DRAWQUEUE_RESETCLIP:
+ GL_ScissorTest(false);
+ break;
+ }