Skip to main content
GameDev.net gamedev.net
🔒 Locked

EXT_depth_bounds_test

Started by gaurav khanduja Sep 21, 2006 at 1:29 PM 2 replies 1.6k views
Original Post
gaurav khanduja
gaurav khanduja
Hi, Just want to know how does EXT_depth_bounds_test work. A small example would be highgly appreciated. glDepthBoundsEXT (0.00 , 1.00 ); Will the above command clamp the znear and zfar planes to the given range ([0,1] in this case) OR it will enable testing of the depth value of the incoming fragment between the given range. I assumed the latter case and I implemented void display(void) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity (); glMultMatrixf (state->rot_matrix); glEnable(GL_EXT_depth_bounds_test); glDepthBoundsEXT ( 0.2 , 0.3 ) ; drawscene(); glDisable(GL_EXT_depth_bounds_test); glutSwapBuffers(); glutPostRedisplay(); } I was expecting the portion of the drawscene to be clipped, but it didnt happen. Thanks.
StealthNinja
StealthNinja
The depth bounds test is an entirely new test. Normal depth testing compares the new fragment's depth against the depth stored in the depth buffer. The depth bounds test compares the depth already in the buffer against the minimum and maximum, and discards the fragment if they're outside that range. It's meant to be used to optimize shadow volumes in much the same way as you can use the scissor test to do so.
Kalidor
Kalidor
And the correct enum for the cap parameter of glEnable/glDisable is GL_DEPTH_BOUNDS_TEST_EXT. GL_EXT_depth_bounds_test is just the name of the extension.
gaurav khanduja
gaurav khanduja
Thanks a lot.

Now the code works. But I have one more doubt.

If I give the range [0,1]

glDepthBoundsEXT ( 0.0 , 1.0 ) ;

it works.

But if I give anything else like glDepthBoundsEXT ( 0.0 , 0.99 ) ; it doesnt show me anything.

I dont understand what could be reason for that.

Thanks

Topic Locked

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

Sign in to reply to this topic.