Sign in to follow this  
Aragon

short question about 16/24/32bit z buffer

Recommended Posts

hi @all i got my landscape running very well but my water plane got a lot of artefacts at the edges..i know this problem is because of the Z Buffer but how/where in the initialisation can i switch to an 32bit z buffer? my depth values range is from 1.0 -> 100.0 ( i am at work, hiding from our manager i write here in my work, so my source code and screenshots i can show later if needed) greetings 00Aragon ;)

Share this post


Link to post
Share on other sites
If you are on Win32, then when you set the pixel type, it is a parameter of the function that you call when getting the type of pixel, which you then send to SetPixelFormat/ChoosePixelFormat. I can't remember which is which. For my uses, I have a 24bit Z-buffer and 8-bit stencil buffer becuase I have heard that many video cards work best in this situation.

Share this post


Link to post
Share on other sites
http://img154.imageshack.us/img154/7015/bild0018yd.jpg


here is my problem,
the screen is flickering at edges


list of things i use:

glEnable(GL_TEXTURE_2D);

glEnable (GL_DEPTH_TEST);

glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );

glDepthRange(0.0,1.0); // i also try glDepthRange(0.0,100.0);

glDepthFunc(GL_LEQUAL); //GL_LESS

glClearDepth(1.0);



....
//from init

if( !(pfd.dwFlags & PFD_SUPPORT_OPENGL) )
continue;

if( !(pfd.dwFlags & PFD_DOUBLEBUFFER) )
continue;

//if( !(pfd.dwFlags & PFD_DRAW_TO_WINDOW) && screen==0 ) continue;

if( pfd.iPixelType != PFD_TYPE_RGBA )
continue;

if( pfd.cColorBits != 32 )
continue;

if( pfd.cDepthBits != 24 )
continue;

Share this post


Link to post
Share on other sites
thx ff8 (uhm your answer is now missing here)


wow.. lol.... that was it!!!!!!


it was this little thing with 1.0 near value
(it was 0.1 )

much much thx for all your help

Share this post


Link to post
Share on other sites
No consumer card actually has 32 bit depth buffers -- they have 24 bits of depth, and 8 bits of stencil. Thus, request 24 bits of depth.

Also, even if pushing near out to 1.0 "fixes" the problem, you're probably still in 16 bit depth mode. 0.1 should work fine in 24-bit mode for most geometry.

Btw: Some older cards don't like having a different depth mode from color mode, so when desktop is 16 bits, it'll be in 16 bit depth; 24/32 bit desktop means 24 bit depth.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this