Hi. I’m having problems implementing the glOrtho projection and i’d like some help.
I have a scene with the drawing loop drawing a textured sphere.
It uses lighting and object lists.
I just want to add on top of this scene a 2d polygon.
(for menu usage)
the draw routine is like this:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
glPushMatrix();
glTranslatef(0, 0, cameraDistance);
glRotatef(cameraAngleX, 1, 0, 0); // pitch
glRotatef(cameraAngleY, 0, 1, 0); // heading
glPushMatrix(); // draw sphere
if(animateFlag) angle += 0.5f;
glRotatef(angle, 0.39875f, 0.91706f, 0.0f);
glCallList(listId); // render with display list
glPopMatrix();
glPopMatrix();
i just add this code
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glPopMatrix();
but it just results in a black screen…
any idea what i’m doing wrong.
Thanks