No Z-axis?

what did I do wrong? theese are just 2 quads which should rotate around the y-axis. but always the second (the red one) is in the foreground. here’s the code…

void Scene1::Render()
{
glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glRotatef(Angle, 0, 1, 0);
Angle += 1.0f;
if (Angle == 360.0f) Angle =0.0f;

glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, -0.5f);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(-0.5f, +0.5f, -0.5f);
glVertex3f(+0.5f, +0.5f, -0.5f);
glVertex3f(+0.5f, -0.5f, -0.5f);
glVertex3f(-0.5f, -0.5f, -0.5f);
glEnd();
glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, +0.5f);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(-0.5f, +0.5f, +0.5f);
glVertex3f(+0.5f, +0.5f, +0.5f);
glVertex3f(+0.5f, -0.5f, +0.5f);
glVertex3f(-0.5f, -0.5f, +0.5f);
glEnd();
return;
}

and I can’t move the camera with glTranslatef in any z-direction…
can you help me?

g.h.

[This message has been edited by hollowcoder (edited 08-30-2002).]

what have you set your projection/ortho with?

that’s my init-routine:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(1.0f, (GLfloat) WidthOfWindow / (GLfloat) HeightOfWindow, 0.5f, 100.0f); glMatrixMode(GL_MODELVIEW);

When is your Init routine run? If it gets run before your GL context is setup, all of your gl functions there will fail.

You are asking for a depth buffer when you start gl?

ah, thank you! I first have set up my screen details and then init opengl. now it works

thx very much )