Archived

This topic is now archived and is closed to further replies.

Astroguru

Depth Test not getting enabled

Recommended Posts

Hi. In my application, i have enabled the depth test using glEnable(),as: glutInitDisplayMode(GLUT_DEPTH | GLUT_RGB | GLUT_DOUBLE); glEnable(GL_DEPTH_TEST); Right after that, i check whether it is enabled : if(glIsEnabled(GL_DEPTH_TEST) == GL_TRUE) printf("Depth Enabled"); But it is not getting enabled, and i am not getting an output. Can someone explain to me what the problem is? Thanks.

Share this post


Link to post
Share on other sites
It''s been a long time since I''ve used GLUT so I may be wrong but I think you shouldn''t call GL commands right after glutInitDisplayMode. All GL commands called before the glutMainLoop (or whatever the function is called) will be ignored. This is because the actual OGL rendering context is only created once you call this function. GLUT functions called before only tell GLUT how it should set it up, they don''t create anything.

Share this post


Link to post
Share on other sites
Mostly correct, except that the rendering context is created when glutCreateWindow is called. So before the window is created, no OpenGL functions will work. You can call OpenGL functions before entering the main loop, as long as it''s after a window is created.

Share this post


Link to post
Share on other sites
Hey Thanks a lot, that works!! Now that u have talked about rendering context, just another question. I know that rendering context is created for every window, but does this impart the complete rendering capability to each window. For ex if my system support 32 matrices on the modelview stack, does that mean that now each window will have 32 matrices with it, as it has a separate rendering context. Well i don't have a much clear understanding on the subject, but i am sure u can help.
Thanks.

[edited by - astroguru on March 19, 2004 9:11:21 AM]

Share this post


Link to post
Share on other sites