View Full Version : Depth Buffer in MesaGL
12-22-2000, 04:06 AM
Sorry my english,
I want to know how i use the depth buffer in Linux, i make all the things right (The same code runs in windows); i use glut and mesaGL, lastest libraries.
This is mostly an OS independent question.
The OS dependent part is that you have to request a depth buffer when initializong your windows for OpenGL, but if you use glut, then it is super easy. The line
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
will do it.
Then, you have to glEnable(GL_DEPTH_TEST) (i guess you more than knew this...), and make sure your projection matrix is properlly setup to give some decent precision for the zbuffer (setting the near plane greater than 0, and the far plane not too far, see gluPerspective). Of course, there are other functions to fine tune depth testing, but the are set by default to reasonable values that work.
I dont know what's your level in this matter, but at least this is the very basic. let me know more about your app.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.