speed
04-03-2007, 08:40 AM
How works depth bounds test?
I am trying to use this option, but I can't do an example to understand the behaviour.
This is my code
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, 0, height, -1.0,0.0001);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(0, 0, 0, 0);
glClearDepth(1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
glDepthBoundsEXT(0.0,0.5);
glPointSize(128);
// red
glBegin(GL_POINTS);
glColor4f(1.0,0.0,0.0,0.5);
glVertex3f(128, 128, 0.9);
glEnd();
// blue
glBegin(GL_POINTS);
glColor4f(0.0,0.0,1.0,0.5);
glVertex3f(135, 135, 0.0);
glEnd();I don't understand exactly which z-coords use to compare with zmin and zmax of Depth Bounds.
In this example, I expect to obtain a blue point only in the screen, because the red one is rejected because its z-coord(0.9) is outside the range [0..0.5] of the bound test. But I see a black screen... :eek:
Someone knows what I do wrong? Is there any example of depth_bound_test_ext?¿
PD: I am using a NVIDIA and the driver 97.55
I am trying to use this option, but I can't do an example to understand the behaviour.
This is my code
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, width, 0, height, -1.0,0.0001);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glClearColor(0, 0, 0, 0);
glClearDepth(1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_DEPTH_BOUNDS_TEST_EXT);
glDepthBoundsEXT(0.0,0.5);
glPointSize(128);
// red
glBegin(GL_POINTS);
glColor4f(1.0,0.0,0.0,0.5);
glVertex3f(128, 128, 0.9);
glEnd();
// blue
glBegin(GL_POINTS);
glColor4f(0.0,0.0,1.0,0.5);
glVertex3f(135, 135, 0.0);
glEnd();I don't understand exactly which z-coords use to compare with zmin and zmax of Depth Bounds.
In this example, I expect to obtain a blue point only in the screen, because the red one is rejected because its z-coord(0.9) is outside the range [0..0.5] of the bound test. But I see a black screen... :eek:
Someone knows what I do wrong? Is there any example of depth_bound_test_ext?¿
PD: I am using a NVIDIA and the driver 97.55