Skip to main content
gamedev.net
🔒 Locked

Depth buffer bits

Started by jho Jun 22, 2000 at 3:39 PM 4 replies 550+ views
Original Post
jho
jho
I''m writing some OpenGL code for laptops so I''m trying to cut down memory size and load, etc. I''m thinking for cutting down DepthBuffer size from 32-bit to 16-bit. My Frustrum set by GluPerspective have a zNear and zFar of 0 to 10000. Is it safe to say that 16bit depth buffer is sufficient in my case, because 2^16 > 10000? Is my reasoning correct? This is set with PixelFormatDescriptor, right? (What other flags can I set to optimize?) PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // Size of this structure 1, // Version of this structure PFD_DRAW_TO_WINDOW / // Draw to Window (not to bitmap) PFD_SUPPORT_OPENGL / // Support OpenGL calls in window PFD_DOUBLEBUFFER, // Double buffered mode PFD_TYPE_RGBA, // RGBA Color mode 32, // Want 16bit color 0,0,0,0,0,0, // Not used to select mode 0,0, // Not used to select mode 0,0,0,0,0, // Not used to select mode 16, // Size of depth buffer 0, // Not used to select mode 0, // Not used to select mode PFD_MAIN_PLANE, // Draw in main plane 0, // Not used to select mode 0,0,0 }; // Not used to select mode
jho
jho
Can someone please answer my question..? I don''t think it''s a tough question for you guys..
-BacksideSnap-
-BacksideSnap-
You have the wrong idea about the z-buffer. More z-buffer bits means a more accurate z-buffer. This has nothing to do with the size of your viewing frustum. Also, in your reasoning (which is incorrect anyway you forgot to take into account what is right of the decimal point. Generally the z-buffer will range from 0.0 at the near clipping plane to 1.0 at the far clipping plane.

Hopefully that answers your questions.

-BacksideSnap-
acw83
acw83
No he is right, the size of the frustrum CAN affect the z-buffer accuracy. If you have a super accurate 32 bit buffer, then a frustrum with a depth of say 0.01 units should appear ok because you have 429496729600 levels of buffering, but a 16 bit buffer would have only 6553600 levels of buffering. In a situation with a high number of polys the view frustrum determines the accuracy in between depths. However, most programs don''t have this problem, but just so you know, view frustrum can affect accuracy, and a 16 bit z buffer is less accurate than a 32 bit. I would suggest letting the user set an option or something so that those with better machines can get the better affect.

---
www.crazycrackerz.org
-BacksideSnap-
-BacksideSnap-
No, he was wrong, and you can't read. Did I not mention accuracy in my post? Actually, **** it, I don't care anymore. Every time I try and clear something up someone comes in with some stupid ****. The original poster was thinking that the z-buffer had to be bigger than the size of the viewing depth. Yes, a larger viewing depth obviously affects accuracy, but it doesn't mean you couldn't use a 2-bit z buffer if you wanted (theoretically).

-BacksideSnap-

(Control your language, this is a public forum - WitchLord)

Edited by - WitchLord on June 26, 2000 3:01:02 PM
-BacksideSnap-
-BacksideSnap-
Wow, censored twice by WitchLord. Don''t worry, I think I''m through posting here. You know your ****, but I think that people here are capable of handling a little bit of language every now and then. Live on Big Brother.

-BacksideSnap-

Topic Locked

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

Sign in to reply to this topic.