Can someone explain me why gf4 can’t set better zbuffer than 16bits? I’ve tried on multiple cards, Radeons, Gf3, even Riva and Voodoo2 could set 24bit zbuffer, so why gf4 can’t. I’ve checked Nvidia tech-specification list on gf4 series and there is clearly stated “32bit color Z/Stencil support”.
It’s real annoyance especially when I really could use those additional 8bits (if not whole 32bits) for Zbuffer.
Thanks for reply
If you work in 16 bit high-color resolutions try 32 bits true color.
It should just work. Make sure you really have requested 24 bits depth in the pixelformat structure and got a hardware accelerated pixelformat (glGetString(GL_VENDOR)).
I work in 32bit desktop so opengl takes 32bit color. GL_VENDOR contains “NVIDIA Corporation”
Pixel format is 32bit color, 16bit zbuffer
here is the pixel format declaration (taken from NeHe’s tutorial, since I started from those tuts):
static PIXELFORMATDESCRIPTOR pfd={ // pfd Tells Windows How We Want Things To Be
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW| // Format Must Support Window
PFD_SUPPORT_OPENGL| // Format Must Support OpenGL
PFD_DOUBLEBUFFER| // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
bits, // Select Our Color Depth
0,0,0,0,0,0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0,0,0,0, // Accumulation Bits Ignored
// 16, // 16Bit Z-Buffer (Depth Buffer)
24, // 24Bit Z-Buffer (Depth Buffer)
// 32, // 32Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0,0,0 // Layer Masks Ignored
};
(edit)
I’ve just checked RtCW and they DID set PixelFormat to 32Color 24Z 8Stencil.
HOW? O_o
Your code is wrong. pfd.iPixelType = PFD_TYPE_RGBA; is a different field, not an ORed mask in the flags.
Replace the ‘|’ behind PFD_DOUBLEBUFFER with ‘,’.
THANKS A LOT!
it really helped, thats what you get when you rewrite the tuts late at night. I never suspected that error will be here, because it worked for everyone else. usually when something is wrong it doesnt work at all
once again, thanks