Archived

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

BigFatBaby

depth buffer testing...

Recommended Posts

i have an ogl environment with the z buffer set up to 1000f i have these two lines of code for the depth testing:
glEnable(GL_DEPTH_TEST);
glEnable(GL_DEPTH_FUNC); 
but whenever an object gets two far away from the perspective the depth buffer fails all the depth testing (OGL doesnt know which object to put in front of the other one...) any help would be greatly appriciated...

Share this post


Link to post
Share on other sites
have a look where you create the window theres something like
pixelformat
or pixelformat descriptor

you need to set you depthbuffer to 24 bit
most people use only 16 bit

and you need to more your near clippingplane further away from the eyes i use 16 for the near and 16000 for the far

the height of a player is 72 units in my engine
and a room is 128 units high
typical measure of quake engines

Share this post


Link to post
Share on other sites
quote:
Original post by BigFatBaby
glEnable(GL_DEPTH_TEST);
glEnable(GL_DEPTH_FUNC);




Althought I don''t think it''s directly related to your problem, you shouldn''t do this but something like this instead :

glEnable(GL_DEPTH_TEST);
glDepthFunc( /* a depth func constant*/ );


Calling glEnable(GL_DEPTH_FUNC) doesn''t do anything except perhaps raising an OGL error (the GL_DEPTH_FUNC token isn''t accepted by the glEnable function). Give a look to the glDepthFunc documentation.

Back to the real problem : it seems like "bad" values for the near and far planes.

Share this post


Link to post
Share on other sites
i cleared the bit buffer, i think i''ll use the diffrent values for the near and far planes...
thank you

btw: the token GL_DEPTH_FUNC is acceptable by the OGL, i dont have any syntax errors, only logical ones... (oooh, good sentence, i think i will use it in my sig)

----------------------------------------------------------
Winners never quit
Quitters never win
But those who never win and never quit are idiots!!!

Share this post


Link to post
Share on other sites