View Full Version : Z-buffering
I want to know how to use z-buffering in openGL. I have a winodw initialized using x-windows, I am not using glut.
I read the Red Book, but it is too complicated for me.
Is any one have any sample code for beginners.
I want to draw a square at depth 2 and a circle at depth 1, I just got the basics by reading the book. But didn't understand completely to write a program.
please help me
10-17-2007, 01:10 PM
Z-buffering is done automatically if you're rendering to a framebuffer that has a depth buffer attached.
If you pass GLUT_DEPTH as one of the flags to glutInitDisplayMode, this will be the case by default.
Oh, and drawings circles, not so simple as it sounds. Triangles are much easier. Start there.
Thankyou for the reply, I mentioned that I am not using glut. I am using x-winodws and glx calls to draw. I can understand about the circle, so I will start with a triangle.
"If you pass GLUT_DEPTH as one of the flags to glutInitDisplayMode" how can I do it in glx calls
10-17-2007, 07:01 PM
I don't know glx well enough to say. There's a place to specify how many bits you want to use for depth somewhere or other; you want 24, probably.
I'm surprised you're going that route; most beginners start with GLUT because it removes the complexity of establishing a context, and allows you to just get down to the gl calls immediately.
10-17-2007, 07:03 PM
I'm not that familiar with GLX either, but there seems to be a nice tutorial in the wiki here (http://www.opengl.org/wiki/index.php/Programming_OpenGL_in_Linux:_GLX_and_Xlib) .
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.