]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix D3D scissoring
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 13 Oct 2010 19:32:40 +0000 (19:32 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 13 Oct 2010 19:32:40 +0000 (19:32 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10524 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 3633665a69bb486da5b9fb957587d7079b82d7cc..0c831f238a80554047358e4ab5a3525a67bc2e5d 100644 (file)
@@ -8020,9 +8020,25 @@ static void R_View_SetFrustum(const int *scissor)
                fpx =  1.0 - 2.0 * (scissor[0]              - r_refdef.view.viewport.x) / (double) (r_refdef.view.viewport.width);
                fnx =  1.0 - 2.0 * (scissor[0] + scissor[2] - r_refdef.view.viewport.x) / (double) (r_refdef.view.viewport.width);
 
-               // non-flipped y coordinates
-               fny = -1.0 + 2.0 * (scissor[1]              - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height);
-               fpy = -1.0 + 2.0 * (scissor[1] + scissor[3] - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height);
+               // D3D Y coordinate is top to bottom, OpenGL is bottom to top, fix the D3D one
+               switch(vid.renderpath)
+               {
+                       case RENDERPATH_D3D9:
+                       case RENDERPATH_D3D10:
+                       case RENDERPATH_D3D11:
+                               // non-flipped y coordinates
+                               fny = -1.0 + 2.0 * (vid.height - scissor[1] - scissor[3] - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height);
+                               fpy = -1.0 + 2.0 * (vid.height - scissor[1]              - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height);
+                               break;
+                       case RENDERPATH_GL11:
+                       case RENDERPATH_GL13:
+                       case RENDERPATH_GL20:
+                       case RENDERPATH_CGGL:
+                               // non-flipped y coordinates
+                               fny = -1.0 + 2.0 * (scissor[1]              - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height);
+                               fpy = -1.0 + 2.0 * (scissor[1] + scissor[3] - r_refdef.view.viewport.y) / (double) (r_refdef.view.viewport.height);
+                               break;
+               }
        }
        else
        {