View Full Version : scene init works wrong

07-11-2010, 03:59 AM
glClear(0.2, 0.2, 0.2) and glEnable(GL_DEPTH_TEST) works wrong.
Problem is when I try to init the scene with glClear(0.2, 0.2, 0.2) one time it works right, i.e I see gray backcolor, another time backcolor is black and the objects shown are transparent. Its not right. Any suggestions?

07-11-2010, 08:19 AM
glClear() is not used that way. To set the clear color, use glClearColor(red, green, blue, alpha) and to actually clear the screen, use glClear(GL_COLOR_BUFFER_BIT) or if you have depth testing enabled, glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT).

07-12-2010, 07:43 AM
Thanks a lot. I think I have find out the problem. I set enabled blending mode, so I saw transparent objects and black screen. When blending is disabled all work right.

07-13-2010, 03:50 AM
Unfortunately the problem returned. I think it is related with blending, but I don't know how. In my code no blending is used.

07-13-2010, 05:18 AM
Could you post your code, or put it on http://codepad.org/ if it's too long? Then I might be able to see what the problem is.