OK guys, I have a question about openGL ES 1.1 on iPhone. I have a game I'm making and I'm used to the origin being at the upper left hand corner. This is a 2d game, so i'm using glOrtho(). How would I translate openGL so that I can use the upper left hand corner as the origin. Would I use glViewport()?
+2
A:
glViewPort is used to set how much of the window to draw in, so you normally always set it to the size of the window:
glViewport(0, 0, backingWidth, backingHeight);
I'm not expert, I can do it by using glOrthof to transform the projection matrix.
Say for example you want width to be 0-100 and height to be 0-150 you would:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0.0f, 100.0f, 150.0f, 0.0f, -1.0f, 1.0f);
Shane Powell
2009-06-14 02:47:04