]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
fix loading "g"-less .obj files
[xonotic/darkplaces.git] / gl_draw.c
index 1654cd4bf68d01abf8852b5c325ac0587beeada5..5e76d3d67db84053f23e6036832e91b244e03e9b 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -371,9 +371,9 @@ reload:
        pic->autoload = (cachepicflags & CACHEPICFLAG_NOTPERSISTENT);
 
        // load a high quality image from disk if possible
-       pixels = loadimagepixelsbgra(path, false, true, r_texture_convertsRGB_2d.integer != 0, NULL);
+       pixels = loadimagepixelsbgra(path, false, true, false, NULL);
        if (pixels == NULL && !strncmp(path, "gfx/", 4))
-               pixels = loadimagepixelsbgra(path+4, false, true, r_texture_convertsRGB_2d.integer != 0, NULL);
+               pixels = loadimagepixelsbgra(path+4, false, true, false, NULL);
        if (pixels)
        {
                pic->hasalpha = false;
@@ -392,7 +392,7 @@ reload:
                pic->width = image_width;
                pic->height = image_height;
                if (!pic->autoload)
-                       pic->tex = R_LoadTexture2D(drawtexturepool, path, image_width, image_height, pixels, TEXTYPE_BGRA, pic->texflags & (pic->hasalpha ? ~0 : ~TEXF_ALPHA), -1, NULL);
+                       pic->tex = R_LoadTexture2D(drawtexturepool, path, image_width, image_height, pixels, r_texture_sRGB_2d.integer ? TEXTYPE_SRGB_BGRA : TEXTYPE_BGRA, pic->texflags & (pic->hasalpha ? ~0 : ~TEXF_ALPHA), -1, NULL);
        }
        else
        {
@@ -472,9 +472,9 @@ rtexture_t *Draw_GetPicTexture(cachepic_t *pic)
 {
        if (pic->autoload && !pic->tex)
        {
-               pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, r_texture_convertsRGB_2d.integer != 0);
+               pic->tex = loadtextureimage(drawtexturepool, pic->name, false, pic->texflags, true, r_texture_sRGB_2d.integer != 0);
                if (pic->tex == NULL && !strncmp(pic->name, "gfx/", 4))
-                       pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, r_texture_convertsRGB_2d.integer != 0);
+                       pic->tex = loadtextureimage(drawtexturepool, pic->name+4, false, pic->texflags, true, r_texture_sRGB_2d.integer != 0);
                if (pic->tex == NULL)
                        pic->tex = draw_generatepic(pic->name, true);
        }
@@ -516,7 +516,7 @@ cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, u
        {
                if (pic->tex && pic->width == width && pic->height == height)
                {
-                       R_UpdateTexture(pic->tex, pixels_bgra, 0, 0, width, height);
+                       R_UpdateTexture(pic->tex, pixels_bgra, 0, 0, 0, width, height, 1);
                        return pic;
                }
        }
@@ -1015,6 +1015,7 @@ static void _DrawQ_Setup(void)
        r_refdef.draw2dstage = 1;
        CHECKGLERROR
        R_Viewport_InitOrtho(&viewport, &identitymatrix, r_refdef.view.x, vid.height - r_refdef.view.y - r_refdef.view.height, r_refdef.view.width, r_refdef.view.height, 0, 0, vid_conwidth.integer, vid_conheight.integer, -10, 100, NULL);
+       R_Mesh_ResetRenderTargets();
        R_SetViewport(&viewport);
        GL_ColorMask(r_refdef.view.colormask[0], r_refdef.view.colormask[1], r_refdef.view.colormask[2], 1);
        GL_DepthFunc(GL_LEQUAL);
@@ -2047,7 +2048,25 @@ void DrawQ_SetClipArea(float x, float y, float width, float height)
        iy = (int)(0.5 + y * ((float) vid.height / vid_conheight.integer));
        iw = (int)(0.5 + (x+width) * ((float)vid.width / vid_conwidth.integer)) - ix;
        ih = (int)(0.5 + (y+height) * ((float) vid.height / vid_conheight.integer)) - iy;
-       GL_Scissor(ix, vid.height - iy - ih, iw, ih);
+       switch(vid.renderpath)
+       {
+       case RENDERPATH_GL11:
+       case RENDERPATH_GL13:
+       case RENDERPATH_GL20:
+       case RENDERPATH_GLES2:
+       case RENDERPATH_SOFT:
+               GL_Scissor(ix, vid.height - iy - ih, iw, ih);
+               break;
+       case RENDERPATH_D3D9:
+               GL_Scissor(ix, iy, iw, ih);
+               break;
+       case RENDERPATH_D3D10:
+               Con_DPrintf("FIXME D3D10 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__);
+               break;
+       case RENDERPATH_D3D11:
+               Con_DPrintf("FIXME D3D11 %s:%i %s\n", __FILE__, __LINE__, __FUNCTION__);
+               break;
+       }
 
        GL_ScissorTest(true);
 }