GreatApe

04-17-2005, 10:44 PM

I was working some OpenGL ES code on the Nokia v2.0 Open GL SDK, I based how did my Open GL code on on the Example3D game from Nokia, all worked fine upto this point.

I then made a build of the project under the UIQ SDK using the Vincent OpenGL ES implementation, I got this working only to find the whole display was an upside down mirror image of how it appeared under the S60 SDK.

To check it wasn't just me doing something silly I ported the Nokia Example3D project over to the UIQ SDK and sure enough exactly the same problem.

Going back to the original version I had noticed the Y-Axis did seem to be wrong way up, increasing the y-position of an object moved it down the screen.

Trying to understand what's going on here I've been looking at the example (and my code copied from it) uses glLoadMatrixx. The second and third columns all seem to be negated, why is this being done? I can't really get my head around all the complications here, trying something as obvious as making the main 3 columns non-negative, or all negative doesn't give any sensible result, the code I'm looking at is as follows from CPolygonObject.cpp.

// Generate rotate matrix for OpenGl from example's rotate matrix

GLfixed mat[4*4]={ (*aRotateMatrix)[0]*mul, -(*aRotateMatrix)[4]*mul, -(*aRotateMatrix)[ 8]*mul, 0,

(*aRotateMatrix)[1]*mul, -(*aRotateMatrix)[5]*mul, -(*aRotateMatrix)[ 9]*mul, 0,

(*aRotateMatrix)[2]*mul, -(*aRotateMatrix)[6]*mul, -(*aRotateMatrix)[10]*mul, 0,

(*aRotateMatrix)[3]*mul, -(*aRotateMatrix)[7]*mul, -(*aRotateMatrix)[11]*mul, 1 << glShift };

// Init OpenGl for drawing

glLoadMatrixx( mat );

I then made a build of the project under the UIQ SDK using the Vincent OpenGL ES implementation, I got this working only to find the whole display was an upside down mirror image of how it appeared under the S60 SDK.

To check it wasn't just me doing something silly I ported the Nokia Example3D project over to the UIQ SDK and sure enough exactly the same problem.

Going back to the original version I had noticed the Y-Axis did seem to be wrong way up, increasing the y-position of an object moved it down the screen.

Trying to understand what's going on here I've been looking at the example (and my code copied from it) uses glLoadMatrixx. The second and third columns all seem to be negated, why is this being done? I can't really get my head around all the complications here, trying something as obvious as making the main 3 columns non-negative, or all negative doesn't give any sensible result, the code I'm looking at is as follows from CPolygonObject.cpp.

// Generate rotate matrix for OpenGl from example's rotate matrix

GLfixed mat[4*4]={ (*aRotateMatrix)[0]*mul, -(*aRotateMatrix)[4]*mul, -(*aRotateMatrix)[ 8]*mul, 0,

(*aRotateMatrix)[1]*mul, -(*aRotateMatrix)[5]*mul, -(*aRotateMatrix)[ 9]*mul, 0,

(*aRotateMatrix)[2]*mul, -(*aRotateMatrix)[6]*mul, -(*aRotateMatrix)[10]*mul, 0,

(*aRotateMatrix)[3]*mul, -(*aRotateMatrix)[7]*mul, -(*aRotateMatrix)[11]*mul, 1 << glShift };

// Init OpenGl for drawing

glLoadMatrixx( mat );