PDA

View Full Version : Depth Buffer issues


lazyatom
2003.05.05, 11:40 AM
Hi

Bit of a newbie question here, but i'm having some trouble getting depth buffers to work in my app. To add complications, i'm using an interesting blend of tools to get it to work (Ruby, it's opengl extension, RubyCocoa and finally Cocoa).

Basically - is there anything special I need to do to enable the depth buffer in the Cocoa GLView component? I'm clearing the DEPTH_BUFFER bit, and enabled GL_DEPTH_TEST, but it still doesn't seem to work. When I use the same GL code, but in a GLUT context rather than a Cocoa one, I need to add this call to make it work:

GLUT.InitDisplayMode(GLUT::DOUBLE | GLUT::RGB | GLUT::DEPTH);

any ideas anyone?

(as an aside, NSOpenGLView's setNeedsDisplay(true) doesn't seem to do anything for me either :(

DoG
2003.05.05, 01:38 PM
Are you sure you are requesting a depth buffered OpenGL context from the NSOpenGLView? If you have it in IB, check the settings, if you are setting it up programmatically, make sure you request a depth buffer.

lazyatom
2003.05.05, 02:54 PM
excellent - my bad for not looking around a bit more - now it works :)

thanks very much

- james

kelvin
2003.05.06, 04:04 AM
I don't think the display function flushes the buffer. You may have to flush it yourself.

[[GLView openGLContext] flushBuffer];