I'm using OpenGL ES to draw my images and I currently my view setups are these:
gl.glClearColor(0.6f, 0.6f, 1f, 1f);
gl.glClearDepthf(1.0f);
gl.glViewport(0, 0, varScreenWidth, varScreenHeight);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glLoadIdentity();
gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glOrthof(0f, width, 0f, height, -10f, 10f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
I want to roll my whole view on Z axis but I can't use glRotate(). Because my objects are moving from the right to the left and when I do that I have to add offset to their Y position. I need a way to rotate whole view on Z axis like camera roll so the objects are gonna move on Y position automatically. I've tryed to add y offset by multiplying (ScreenWidth - ObjPositionX) and sin(Zroll) but this has some visual problems objects are not staying in their position perfectly. Thank you for any help...
- Edit
Ok someones wanted me to be more Clear. So the function glRotate is rolling my objects over their orgin. But I need a way to roll whole view on Z axis as it's orgin is center of view not the single object. So if the object is on the left side of center it will be seen higher. If objects is on the right side it will seen lower.