Skip to main content
gamedev.net
🔒 Locked

depth buffer testing...

Started by BigFatBaby 3 replies 750+ views
Original Post
BigFatBaby
BigFatBaby
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...
----------------------------------------------------------I dont have syntax error....Only logical ones...
Basiror
Basiror
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
http://www.8ung.at/basiror/theironcross.html
Prosper/LOADED
Prosper/LOADED
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.
Basiror
Basiror
did you clear the GL_DEPTH_BUFFER_BIT?
http://www.8ung.at/basiror/theironcross.html
BigFatBaby
BigFatBaby
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!!!
----------------------------------------------------------I dont have syntax error....Only logical ones...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.