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

32 bit depth buffer using GLUT

Started by CyberSlag5k Feb 4, 2005 at 3:29 PM 8 replies 1.9k views
Original Post
CyberSlag5k
CyberSlag5k
I've googled about 5 different phrases, searched gamedev, checked the red and the blue book, but I cannot find a way to do what I should think is relatively simple. All I want to do is set the depth buffer to be a 32-bit buffer instead of 16. It's a rather trivial manner to do it using the windows pixel format creator, but in GLUT I'm not really finding much. Can someone help me out, please?
Without order nothing can exist - without chaos nothing can evolve.
Mercury
Mercury
Check out glutInitDisplayString. It's been a while since I've used glut, but I think this is what you're looking for.
zedzeek
zedzeek
FWIW quite a few cards dont support 32 bit depthbuffers eg NO nvidia card supports 32, and often if u ask for one u will get 16bit instead of 24bit
CyberSlag5k
CyberSlag5k
I'm using an nVidia card. Can I at least go up to 24 bits? 16 just isn't enough. I tried this call right before my calling glutMainLoop:

glutInitDisplayString("depth>=24");

And I'm still getting 16. Did I call the function in the wrong spot, did I get the string wrong, or is this just not possible?
Without order nothing can exist - without chaos nothing can evolve.
CyberSlag5k
CyberSlag5k
Quote:
Original post by zedzeek
try glutInitDisplayMode( GL_STENCIL | plus whatevre else )


Well that enables the depth buffer but doesn't allow me to specify a size.
Without order nothing can exist - without chaos nothing can evolve.
zedzeek
zedzeek
Quote:
Well that enables the depth buffer but doesn't allow me to specify a size.

true its a bit hackish, but a lot of cards pack depth/stencil together in a 32bit value, thus if u ask for stencil (8biit) u get 24bit depth (and not 16bit like youve been getting)
CyberSlag5k
CyberSlag5k
Quote:
Original post by zedzeek
Quote:
Well that enables the depth buffer but doesn't allow me to specify a size.

true its a bit hackish, but a lot of cards pack depth/stencil together in a 32bit value, thus if u ask for stencil (8biit) u get 24bit depth (and not 16bit like youve been getting)


You're right. That worked like a charm. Thanks.

Why is it that video cards don't support bigger buffers for this sort of thing? Is it that the buffers have to be stored in super fast, expensive memory and so adding like 128 bits would significantly increase the size of the card?
Without order nothing can exist - without chaos nothing can evolve.
zedzeek
zedzeek
in 99.9% of situtations a 24bit depth buffer is sufficent thus as higher bit depths are gonna be slower to implement theres not a great call for them, look how long its taken to get floating point buffers which are a far higher priority than higher depthbuffers
_the_phantom_
_the_phantom_
you also get some intresting alignment issues with a 32bit depth buffer, namely the spare 8bit stencil buffer floating around. This could lead to either (a) unaligned memory (VERY BAD) or (b) wasted space to align the memory (keeps speed but framebuffer size increase).

You can get 32bit depth buffer, certainly on ATI cards, but I dont know how fast its gonna be.

Topic Locked

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

Sign in to reply to this topic.