View Full Version : Regarding Depth Buffer

12-30-2010, 09:46 PM

im using glDrawPixels() to draw some pixel data that i read from a file. After that, im trying to draw other objects. But, im the objects are not visible when i enable depth buffering.

glDrawPixels(640, 480, GL_RGB, GL_UNSIGNED_BYTE, image_data);

glColor3f(1.0, 0.0, 0.0);

Here, the Cube appears when i disable depth buffer. But i cannot see the cube when depth buffering is enabled.

i even tried using Textures, but the cube does not appear.

Can anyone please tell me what the problem could be?

12-31-2010, 03:07 AM
I think you should use glRasterPos to select the depth value before using glDrawPixels.

I don't know what default values it is when you don't specify glRasterPos before.

12-31-2010, 03:29 AM
try a glClear(GL_DEPTH_BUFFER); after glDrawPixels.

12-31-2010, 06:02 AM
Thanks _arts_, Zbuffer.

Both the methods worked. :)