View Full Version : Depth_buffer
I would like to use the DepthBuffer. I used this command to enable it:
and in the main loop:
but it doesn't work and I would like to know why(I still see the rectangle that should be in the back in the front)? can someone help me?
Thanx (sorry for my English...I'm Italian)
12-21-2001, 12:53 PM
Looks ok to me. I normally use the default GL_LESS.
Maybe you are calling glDepthMask(GL_FALSE)?
12-21-2001, 01:04 PM
Or maybe you are looking in the opposite direction of what you think. Remember that the camera looks towards the negative z-axis so z=-1 is closer than z=-2
the same programm made under Visual C++ works...but with C++ (normal) it doesn't.
Ehm, can you explain that one a bit more please. You say it works with Visual C++, but not with normal C++?
Thing is, Visual C++ IS normal C++. The Visual part is just the name of Microsofts "normal" C++ compiler.
you're right...what I wanted to say is that the programm I made starting from zero, where I included only windows.h, gl.h and glu.h (where I copied the "open a window" part), it's seems that it doesn't use the detph buffer, even if I tell him to use it (with enable(DEPTH_BUFFER....bla...bla));while with a programm that start with all the classes already done (MFC) the openGL seem to use the depth buffer normally.
Do you even ask for a depth buffer when creating the pixel format? If you don't ask for a depth buffer, you can't say for sure you will get one.
I found it! It' was my stupidity!...It's was glperspective(angle,aspect,near,far)...near and far should be positive...and I put 0.0 as value for near. I'm really sorry for stealing your time for such a stupid thing. Thax
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.