Hi,
I've added glClearDepth, but still the same image. I have the following
in my code:
main()
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
init();
showTriangles();
Quote:}
void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_POLYGON_SMOOTH);
glDepthRange(0, 1);
glClearDepth(1.0f); //added in, but still no effect :-(
Quote:}
showTriangles()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //yes, I have a
glClear
drawTriangles();
drawMoreTriangles();
glutSwapBuffers();
Quote:}
drawTriangles()
{
glPushMatrix();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glBegin(GL_POLYGON);
//draw triangle
glEnd();
glPopMatrix();
Quote:}
drawMoreTriangles()
{
//same as drawTriangles..
Quote:}
Do I need glFrontFace? or etc? I'm just drawing triangles though.
Thanks,
rach
> Hiya
> Judging by the images it appears that the depth buffer isn't working yet,
> try adding
> glClearDepth(1.0f);
> somewhere in your initialisation section.
> At the beginning of your painting routine you should have a line along the
> lines of:
> glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
> This will clear the screen & reset the depth buffer to the value that you
> specified in glClearDepth().
> hope this helps
> cu|K