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.
This commit is contained in:
Stefan Dösinger 2007-03-03 02:35:17 +01:00 committed by Alexandre Julliard
parent 7126b63645
commit 2cdced8193
1 changed files with 10 additions and 2 deletions

View File

@ -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");