static rtexture_t *draw_generateditherpattern(void)
{
+#if 1
+ int x, y;
+ qbyte data[8*8*4];
+ for (y = 0;y < 8;y++)
+ {
+ for (x = 0;x < 8;x++)
+ {
+ data[(y*8+x)*4+0] = data[(y*8+x)*4+1] = data[(y*8+x)*4+2] = ((x^y) & 4) ? 255 : 0;
+ data[(y*8+x)*4+3] = 255;
+ }
+ }
+ return R_LoadTexture2D(drawtexturepool, "ditherpattern", 8, 8, data, TEXTYPE_RGBA, TEXF_FORCENEAREST | TEXF_PRECACHE, NULL);
+#else
qbyte data[16];
memset(data, 255, sizeof(data));
data[0] = data[1] = data[2] = data[12] = data[13] = data[14] = 0;
return R_LoadTexture2D(drawtexturepool, "ditherpattern", 2, 2, data, TEXTYPE_RGBA, TEXF_FORCENEAREST | TEXF_PRECACHE, NULL);
+#endif
}
/*
pic->tex = draw_generateditherpattern();
if (pic->tex == NULL)
{
- Con_Printf ("Draw_CachePic: failed to load %s\n", path);
+ Con_Printf("Draw_CachePic: failed to load %s\n", path);
pic->tex = r_notexture;
}
hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
for (pic = cachepichash[hashkey];pic;pic = pic->chain)
{
- if (!strcmp (picname, pic->name))
+ if (!strcmp (picname, pic->name) && pic->tex)
{
R_FreeTexture(pic->tex);
pic->width = 0;
quadelements[pos++] = num + 3;
}
}
- GL_SetupView_ViewPort(vid.realx, vid.realy, vid.realwidth, vid.realheight);
+ qglViewport(0, 0, vid.realwidth, vid.realheight);
GL_SetupView_Mode_Ortho(0, 0, vid.conwidth, vid.conheight, -10, 100);
qglDepthFunc(GL_LEQUAL);
- R_Mesh_Start();
R_Mesh_Matrix(&r_identitymatrix);
chartexnum = R_GetTexture(char_texture);
R_Mesh_Draw(mesh->num_vertices, mesh->num_triangles, mesh->data_element3i);
currentpic = "\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.realwidth / vid.conwidth);
+ // OGL uses top to bottom
+ y = dq->y * ((float) vid.realheight / vid.conheight);
+ width = dq->scalex * ((float)vid.realwidth / vid.conwidth);
+ height = dq->scaley * ((float)vid.realheight / vid.conheight);
+
+ GL_Scissor(x, y, width, height);
+
+ GL_ScissorTest(true);
+ }
+ break;
+ case DRAWQUEUE_RESETCLIP:
+ GL_ScissorTest(false);
+ break;
}
}
R_Mesh_Draw(3, 1, polygonelements);
}
}
- R_Mesh_Finish();
}