[solved]Depth Buffer Configuration

Started by
0 comments, last by GloW_on_dub 14 years ago
Hello all. I'm now implementing Depth peeling algorithm. So i check my depth buffer. and i observed a strange comportement. i try to draw (deferred) this :
     glBegin(GL_QUADS);
glPushMatrix();

            colorConvert(1001);
glVertex3f(-10, 0, -2 );
glVertex3f( 10,0, -2);
glVertex3f( 10,-10,-2); 
glVertex3f( -10,-10,-2); 

glPopMatrix();*/
glPushMatrix();

            colorConvert(1002);
glVertex3f(-15, 1, -3 );
glVertex3f( 15,1, -3);
glVertex3f( 15,-15,-3); 
glVertex3f( -15,-15,-3); 

glPopMatrix();
glEnd();
with this openGL configuration

glEnable(GL_DEPTH_TEST);
	glClearColor(255,255,255,255);

	// S e t t h e p r o j e c t i o n t r a n s f o r m
	glMatrixMode (GL_PROJECTION ) ;
	glLoadIdentity ( ) ;
	gluPerspective( 45, 100/100,1,100 ); 


	// S e t t h e camera o r i e n t a t i o n :
	glMatrixMode (GL_MODELVIEW) ;
	glLoadIdentity();	
	gluLookAt(0,0,5,0,0,4,0,1,0);
and i obtain this results ( only the important part)

row =0 :column =0 :0.865801
row =0 :column =1 :0.865801
...
row =49 :column =98 :0.865801
row =49 :column =99 :0.865801
row =50 :column =0 :0.882877
row =50 :column =1 :0.882877
...
row =50 :column =98 :0.882877
row =50 :column =99 :0.882877
row =51 :column =0 :0.882943
row =51 :column =1 :0.882943
...
row =51 :column =98 :0.882943
row =51 :column =99 :0.882943
row =52 :column =0 :0.883009
row =52 :column =1 :0.883009
...
row =52 :column =98 :0.883009
row =52 :column =99 :0.883009
row =53 :column =0 :0.883075
row =53 :column =1 :0.883075
...
row =53 :column =98 :0.883075
row =53 :column =99 :0.883075
row =54 :column =0 :0.883141
row =54 :column =1 :0.883141
...
row =54 :column =98 :0.883141
row =54 :column =99 :0.883141
row =55 :column =0 :0.883207
row =55 :column =1 :0.883207
...
row =55 :column =98 :0.883207
row =55 :column =99 :0.883207
row =56 :column =0 :0.883272
row =56 :column =1 :0.883272
...
row =56 :column =98 :0.883272
row =56 :column =99 :0.883272
row =57 :column =0 :0.883338
row =57 :column =1 :0.883338
...
row =57 :column =98 :0.883338
row =57 :column =99 :0.883338
row =58 :column =0 :0.883404
row =58 :column =1 :0.883404
...
row =58 :column =98 :0.883404
row =58 :column =99 :0.883404
row =59 :column =0 :0.883470
row =59 :column =1 :0.883470
...
row =59 :column =98 :0.883470
row =59 :column =99 :0.883470
row =60 :column =0 :0.883536
row =60 :column =1 :0.883536
...
row =60 :column =98 :0.883536
row =60 :column =99 :0.883536
row =61 :column =0 :0.883602
row =61 :column =1 :0.883602
...
row =61 :column =98 :0.883602
row =61 :column =99 :0.883602
row =62 :column =0 :0.883668
row =62 :column =1 :0.883668
...
row =62 :column =98 :0.883668
row =62 :column =99 :0.883668
row =63 :column =0 :0.883734
row =63 :column =1 :0.883734
...
row =63 :column =98 :0.883734
row =63 :column =99 :0.883734
row =64 :column =0 :0.883800
row =64 :column =1 :0.883800
...
row =64 :column =98 :0.883800
row =64 :column =99 :0.883800
row =65 :column =0 :1.000000
row =65 :column =1 :1.000000
...
row =99 :column =98 :1.000000
row =99 :column =99 :1.000000
As you can see there is a "first" part from row 0 to 49 where the depth correspond to the first quads (index 1001). after that there is as increasing part from row 50 to row 65. this correspond to the 2nd quads. After a first drop of 0,017076. Each row the depth increase of 0,000066. so i guess there is a linear depth "blur" or something like that. I try to find out how to fix that but i cannot find it on internet. To check my conjecture i've tried with only one quads ( the second index 1002) and i obtain the following results :

row =0 :column =0 :0.883838
row =0 :column =1 :0.883838
...
row =64 :column =98 :0.883838
row =64 :column =99 :0.883838
row =65 :column =0 :1.000000
row =65 :column =1 :1.000000
...
row =99 :column =98 :1.000000
row =99 :column =99 :1.000000
so i can conclude my conjecture is good. so my question is : how to configure the depth buffer not to averaging the value. thx. [Edited by - GloW_on_dub on April 1, 2010 8:28:54 AM]
Advertisement
i've found out why.

i've forget an old glbegin(GL_TRIANGLES) just before my gkbegin(GL_QUADS)

RESOLVED

This topic is closed to new replies.

Advertisement