I used to program OpenGL in RealBasic, but I'm learning C++ now. To initialize OGL I simply ported the code from RB, and now depth testing doesn't work. I use this block of code right after I initialize an AGLContext and set everything up, maybe the problem's in here:
void BaseglInitializeViewport (void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
glClearDepth(1.0);
glDepthFunc(GL_LEQUAL);
glDepthMask(GL_TRUE);
glEnable(GL_COLOR_MATERIAL);
glShadeModel(GL_SMOOTH);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT);
}
Also, when I use AGL_RENDERER_ID, AGL_RENDERER_GENERIC_ID to get a software OGL renderer, depth testing works fine, but under my ATI HWA renderer, with the same code, it doesn't work.
Help!!



You need to specify depth buffer parameters in your pixel format when you are going to be using the depth buffer, like this: