X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=gl_draw.c;h=aa6a0c387bb90bcb13ddb3e51674259480fe4ca8;hb=c4079451039f769eb5444575fad05d4f5925d99e;hp=ef1fee21241ecccbc7803fc06dbe00beb29f6a8f;hpb=8b0fbc64175362acf3ea872029a423012b76a4f8;p=xonotic%2Fdarkplaces.git diff --git a/gl_draw.c b/gl_draw.c index ef1fee21..aa6a0c38 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -413,8 +413,10 @@ reload: if (!pic->autoload) { pic->tex = R_LoadTexture2D(drawtexturepool, pic->name, image_width, image_height, pixels, vid.sRGB2D ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, pic->texflags & (pic->hasalpha ? ~0 : ~TEXF_ALPHA), -1, NULL); +#ifndef USE_GLES2 if (r_texture_dds_save.integer && qglGetCompressedTexImageARB && pic->tex) R_SaveTextureDDSFile(pic->tex, va("dds/%s.dds", pic->name), r_texture_dds_save.integer < 2, pic->hasalpha); +#endif } } if (!loaded) @@ -511,14 +513,18 @@ rtexture_t *Draw_GetPicTexture(cachepic_t *pic) if (pic->tex == NULL) { pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, vid.sRGB2D); +#ifndef USE_GLES2 if (r_texture_dds_save.integer && qglGetCompressedTexImageARB && pic->tex) R_SaveTextureDDSFile(pic->tex, va("dds/%s.dds", pic->name), r_texture_dds_save.integer < 2, pic->hasalpha); +#endif } if (pic->tex == NULL && !strncmp(pic->name, "gfx/", 4)) { pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, vid.sRGB2D); +#ifndef USE_GLES2 if (r_texture_dds_save.integer && qglGetCompressedTexImageARB && pic->tex) R_SaveTextureDDSFile(pic->tex, va("dds/%s.dds", pic->name), r_texture_dds_save.integer < 2, pic->hasalpha); +#endif } if (pic->tex == NULL) pic->tex = draw_generatepic(pic->name, true); @@ -1141,7 +1147,7 @@ void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, flo width = pic->width; if (height == 0) height = pic->height; - R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); #if 0 // AK07: lets be texel correct on the corners @@ -1157,7 +1163,7 @@ void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, flo #endif } else - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); floats[2] = floats[5] = floats[8] = floats[11] = 0; floats[0] = floats[9] = x; @@ -1190,10 +1196,10 @@ void DrawQ_RotPic(float x, float y, cachepic_t *pic, float width, float height, width = pic->width; if (height == 0) height = pic->height; - R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); } else - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); floats[2] = floats[5] = floats[8] = floats[11] = 0; @@ -1235,7 +1241,7 @@ void DrawQ_Fill(float x, float y, float width, float height, float red, float gr return; // R_Mesh_ResetTextureState(); - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); floats[2] = floats[5] = floats[8] = floats[11] = 0; floats[0] = floats[9] = x; @@ -1562,7 +1568,7 @@ float DrawQ_String_Scale(float startx, float starty, const char *text, size_t ma // R_Mesh_ResetTextureState(); if (!fontmap) R_Mesh_TexBind(0, fnt->tex); - R_SetupShader_Generic(fnt->tex, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(fnt->tex, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); ac = color4f; at = texcoord2f; @@ -1698,7 +1704,7 @@ float DrawQ_String_Scale(float startx, float starty, const char *text, size_t ma at = texcoord2f; av = vertex3f; } - R_SetupShader_Generic(fnt->tex, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(fnt->tex, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); map = ft2_oldstyle_map; } } @@ -1767,7 +1773,7 @@ float DrawQ_String_Scale(float startx, float starty, const char *text, size_t ma break; } } - R_SetupShader_Generic(map->pic->tex, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(map->pic->tex, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); } mapch = ch - map->start; @@ -1911,10 +1917,10 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height width = pic->width; if (height == 0) height = pic->height; - R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(Draw_GetPicTexture(pic), NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); } else - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); floats[2] = floats[5] = floats[8] = floats[11] = 0; floats[0] = floats[9] = x; @@ -1943,7 +1949,7 @@ void DrawQ_Mesh (drawqueuemesh_t *mesh, int flags, qboolean hasalpha) DrawQ_ProcessDrawFlag(flags, hasalpha); // R_Mesh_ResetTextureState(); - R_SetupShader_Generic(mesh->texture, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(mesh->texture, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); R_Mesh_PrepareVertices_Generic_Arrays(mesh->num_vertices, mesh->data_vertex3f, mesh->data_color4f, mesh->data_texcoord2f); R_Mesh_Draw(0, mesh->num_vertices, 0, mesh->num_triangles, mesh->data_element3i, NULL, 0, mesh->data_element3s, NULL, 0); @@ -1963,6 +1969,7 @@ void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags) case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: +#ifndef USE_GLES2 CHECKGLERROR qglBegin(GL_LINE_LOOP); for (num = 0;num < mesh->num_vertices;num++) @@ -1973,6 +1980,7 @@ void DrawQ_LineLoop (drawqueuemesh_t *mesh, int flags) } qglEnd(); CHECKGLERROR +#endif break; case RENDERPATH_D3D9: //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); @@ -2000,13 +2008,14 @@ void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, f if(!r_draw2d.integer && !r_draw2d_force) return; - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); switch(vid.renderpath) { case RENDERPATH_GL11: case RENDERPATH_GL13: case RENDERPATH_GL20: +#ifndef USE_GLES2 CHECKGLERROR //qglLineWidth(width);CHECKGLERROR @@ -2018,6 +2027,7 @@ void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, f qglVertex2f(x2, y2); qglEnd(); CHECKGLERROR +#endif break; case RENDERPATH_D3D9: //Con_DPrintf("FIXME D3D9 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__); @@ -2058,7 +2068,7 @@ void DrawQ_Lines (float width, int numlines, const float *vertex3f, const float case RENDERPATH_GL20: CHECKGLERROR - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, (flags & DRAWFLAGS_BLEND) ? false : true, true); //qglLineWidth(width);CHECKGLERROR @@ -2163,7 +2173,7 @@ void R_DrawGamma(void) } // all the blends ignore depth // R_Mesh_ResetTextureState(); - R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true); + R_SetupShader_Generic(NULL, NULL, GL_MODULATE, 1, true, true); GL_DepthMask(true); GL_DepthRange(0, 1); GL_PolygonOffset(0, 0);