Code: Select all
glViewport(0, 0, 320, 480);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrthof(0.0f, 320, 0.0f, 480, -1.0f, 1.0f);
glMatrixMode(GL_MODELVIEW);
glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();
glTranslatef(240, 160, 0);
glRotatef(-90.0, 0, 0, 1);
glTranslatef(-320, -240, 0);
glPopMatrix();
Whenever you rotate things in OpenGL, it rotates around the origin. Which is easily overcomeable by translating to the origin, rotating, then translating back. But I usually do that inside push and pop matrix calls, which I already have...
This is all way to confusing. Does anyone have the code to be able to draw things in Landscape(home button on the right), with the bottom left at 0,0 and the top right at 480,320? And also the code to rotate things around their center no matter where they are? Thanks a bajillion if you do.