Commit 2cdced81 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

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.
parent 7126b636
......@@ -2154,7 +2154,11 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
* the Z coordinate does not affect the size of the primitives
*/
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, -minZ, -maxZ);
glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
if(stateblock->wineD3DDevice->render_offscreen) {
glOrtho(X, X + width, Y, Y - height, -minZ, -maxZ);
} else {
glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
}
} else {
/* If the app mixes transformed and untransformed primitives we can't use the coordinate system
* trick above because this would mess up transformed and untransformed Z order. Pass the z position
......@@ -2164,7 +2168,11 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
* replacement shader.
*/
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, 1.0, -1.0);
glOrtho(X, X + width, Y + height, Y, 1.0, -1.0);
if(stateblock->wineD3DDevice->render_offscreen) {
glOrtho(X, X + width, Y, Y - height, 1.0, -1.0);
} else {
glOrtho(X, X + width, Y + height, Y, 1.0, -1.0);
}
}
checkGLcall("glOrtho");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment