View Full Version : No Depth Testing
06-12-2002, 09:00 AM
For some reason z-buffering/depth testing isn't working in my current project. Polygons display properly except ones in the back can cover up ones in the front. I have had this work in other projects by just putting:
in the setup. However, projects I was using before used GLUT and this one does not. Is there something I'm missing? I don't want to use GLUT.
06-12-2002, 09:59 AM
Just to be sure...
Are you sure the pixelformat you're using has a depth buffer?
You mentioned you were using glut before and now you aren't, which is the only reason I'm asking...
06-12-2002, 10:06 AM
No, I'm not sure the pixelformat has a depth buffer and I'm also not sure how to check whether it does and how to set it so it does! I'm using a skeleton project so I'm not completely sure how it's set up. What specifically should I look for?
06-12-2002, 10:25 AM
Well here's what I found, so it looks like I should have a depth buffer:
const CGLPixelFormatAttribute* GetPixelFormat(u_int32_t display_id = 0x01, int color = settings.depth, int depth = 0, int stencil = 0)
static CGLPixelFormatAttribute attribs;
CGLPixelFormatAttribute* attrib = attribs;
*attrib++ = kCGLPFANoRecovery;
*attrib++ = kCGLPFADoubleBuffer;
*attrib++ = kCGLPFAAccelerated;
*attrib++ = kCGLPFAFullScreen;
*attrib++ = kCGLPFADisplayMask; *attrib++ = (CGLPixelFormatAttribute) display_id;
*attrib++ = kCGLPFAColorSize; *attrib++ = (CGLPixelFormatAttribute) color;
*attrib++ = kCGLPFADepthSize; *attrib++ = (CGLPixelFormatAttribute) depth;
*attrib++ = kCGLPFAStencilSize; *attrib++ = (CGLPixelFormatAttribute) stencil;
*attrib++ = (CGLPixelFormatAttribute) 0;
which is later called by:
CGLError err = CGLChoosePixelFormat(GetPixelFormat(display_id, 32), &pixel_format, &num_pixel_formats);
06-12-2002, 10:44 AM
Ok, sorry once again - I set depth = 16 and it works.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.