[1/7] WineD3D: Adjust the rhw transformation for offscreen rendering

Stefan Dösinger stefan at codeweavers.com
Tue Mar 6 07:58:11 CST 2007


-------------- next part --------------
From 8890156a1ac9247ca57f8f8e65dc67a832272634 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sat, 3 Mar 2007 13:51:43 +0100
Subject: [PATCH] WineD3D: Adjust the rhw transformation for offscreen rendering

When drawing processed vertices with the fixed function pipeline the projection matrix is set up to map y values from 0 to height to 1.0;-1.0(gl and d3d coord systems are flipped).
This moves the y axis to the bottom of the drawing area. When later on the y inversion matrix is applied for offscreen rendering, the coordinate system will get flipped out of the
viewport.

This patch sets the Y range up upside down when using offscreen rendering, so the invymat will flip it to the correct position. This has to
happen before the 0.375 pixel correction.
---
 dlls/wined3d/state.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index ba421a1..c56ce67 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -2155,7 +2155,7 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
              */
             TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, -minZ, -maxZ);
             if(stateblock->wineD3DDevice->render_offscreen) {
-                glOrtho(X, X + width, Y, Y - height, -minZ, -maxZ);
+                glOrtho(X, X + width, -Y, -Y - height, -minZ, -maxZ);
             } else {
                 glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
             }
@@ -2169,7 +2169,7 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
              */
             TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, 1.0, -1.0);
             if(stateblock->wineD3DDevice->render_offscreen) {
-                glOrtho(X, X + width, Y, Y - height, 1.0, -1.0);
+                glOrtho(X, X + width, -Y, -Y - height, 1.0, -1.0);
             } else {
                 glOrtho(X, X + width, Y + height, Y, 1.0, -1.0);
             }
-- 
1.4.4.3



More information about the wine-patches mailing list