Henri Verbeet : wined3d: Construct the non-rhw projection matrix directly in transform_projection() .
Alexandre Julliard
julliard at winehq.org
Wed Nov 2 14:23:35 CDT 2011
Module: wine
Branch: master
Commit: 27132a30f58e691526447caca94faeafb62396fa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=27132a30f58e691526447caca94faeafb62396fa
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Nov 1 20:15:20 2011 +0100
wined3d: Construct the non-rhw projection matrix directly in transform_projection().
---
dlls/wined3d/state.c | 46 ++++++++++++++--------------------------------
1 files changed, 14 insertions(+), 32 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 21797d5..cd03647 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3930,39 +3930,21 @@ static void transform_projection(struct wined3d_context *context, const struct w
}
else
{
- /*
- * Careful with the order of operations here, we're essentially working backwards:
- * x = x + 1/w;
- * y = (y - 1/h) * flip;
- * z = z * 2 - 1;
- *
- * Becomes:
- * glTranslatef(0.0, 0.0, -1.0);
- * glScalef(1.0, 1.0, 2.0);
- *
- * glScalef(1.0, flip, 1.0);
- * glTranslatef(1/w, -1/h, 0.0);
- *
- * This is equivalent to:
- * glTranslatef(1/w, -flip/h, -1.0)
- * glScalef(1.0, flip, 2.0);
- */
- GLfloat xoffset = (63.0f / 64.0f) / state->viewport.Width;
- GLfloat yoffset = -(63.0f / 64.0f) / state->viewport.Height;
-
- glLoadIdentity();
- checkGLcall("glLoadIdentity");
- if (context->render_offscreen)
+ double y_scale = context->render_offscreen ? -1.0 : 1.0;
+ double x_offset = (63.0 / 64.0) / state->viewport.Width;
+ double y_offset = context->render_offscreen
+ ? (63.0 / 64.0) / state->viewport.Height
+ : -(63.0 / 64.0) / state->viewport.Height;
+ const GLdouble projection[] =
{
- glTranslatef(xoffset, -yoffset, -1.0f);
- checkGLcall("glTranslatef(xoffset, -yoffset, -1.0f)");
- glScalef(1.0f, -1.0f, 2.0f);
- } else {
- glTranslatef(xoffset, yoffset, -1.0f);
- checkGLcall("glTranslatef(xoffset, yoffset, -1.0f)");
- glScalef(1.0f, 1.0f, 2.0f);
- }
- checkGLcall("glScalef");
+ 1.0, 0.0, 0.0, 0.0,
+ 0.0, y_scale, 0.0, 0.0,
+ 0.0, 0.0, 2.0, 0.0,
+ x_offset, y_offset, -1.0, 1.0,
+ };
+
+ glLoadMatrixd(projection);
+ checkGLcall("glLoadMatrixd");
glMultMatrixf(&state->transforms[WINED3DTS_PROJECTION].u.m[0][0]);
checkGLcall("glLoadMatrixf");
More information about the wine-cvs
mailing list