fixed sign problem in cogl_setup_vieport

This commit is contained in:
Tomas Frydrych 2007-05-01 20:13:15 +00:00
parent 7d5101ad61
commit d18e432b22

View File

@ -525,13 +525,16 @@ cogl_perspective (ClutterAngle fovy,
#endif #endif
void void
cogl_setup_viewport (guint width, cogl_setup_viewport (guint w,
guint height, guint h,
ClutterAngle fovy, ClutterAngle fovy,
ClutterFixed aspect, ClutterFixed aspect,
ClutterFixed z_near, ClutterFixed z_near,
ClutterFixed z_far) ClutterFixed z_far)
{ {
gint width = (gint) w;
gint height = (gint) h;
GE( glViewport (0, 0, width, height) ); GE( glViewport (0, 0, width, height) );
#define NEG(x) (1 + ~(x)) #define NEG(x) (1 + ~(x))
@ -560,12 +563,27 @@ cogl_setup_viewport (guint width,
-1 << 15, -1 << 15,
NEG(CLUTTER_FLOAT_TO_FIXED(DEFAULT_Z_CAMERA))) ); NEG(CLUTTER_FLOAT_TO_FIXED(DEFAULT_Z_CAMERA))) );
g_debug ("TX1: %f/%f %f/%f %f/%f",
CLUTTER_FIXED_TO_DOUBLE (-1 << 15), -0.5,
CLUTTER_FIXED_TO_DOUBLE (-1 << 15), -0.5,
CLUTTER_FIXED_TO_DOUBLE (NEG(CLUTTER_FLOAT_TO_FIXED(DEFAULT_Z_CAMERA))),
-DEFAULT_Z_CAMERA);
GE( glScalex ( CFX_ONE / width, GE( glScalex ( CFX_ONE / width,
NEG(CFX_ONE) / height, NEG(CFX_ONE) / height,
CFX_ONE / width)); CFX_ONE / width));
g_debug ("SX: %f/%f %f/%f, w %d, h %d",
CLUTTER_FIXED_TO_DOUBLE (CFX_ONE / width), 1.0f / width,
CLUTTER_FIXED_TO_DOUBLE (NEG(CFX_ONE) / height), -1.0f / height,
width, height);
GE( glTranslatex (0, NEG(CFX_ONE) * height, 0) ); GE( glTranslatex (0, NEG(CFX_ONE) * height, 0) );
g_debug ("TX2: %f/%f",
CLUTTER_FIXED_TO_DOUBLE (NEG(CFX_ONE) * height),
-1.0 * height);
#if 0 #if 0
GE( glTranslatex (NEG(CFX_HALF), GE( glTranslatex (NEG(CFX_HALF),
NEG(CFX_HALF), NEG(CFX_HALF),