PDA

View Full Version : ATI HWA Depth Testing



G4Soon
02-19-2001, 07:30 PM
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!!

DJ Tricky S
02-20-2001, 06:00 PM
That all looks fine, how are you setting up your rendering contexts & pixel formats? The bug is probably somewhere in there.

G4Soon
02-20-2001, 06:27 PM
Pixel Format is set up like so:

GLint attrib[] = { AGL_RGBA, AGL_ACCELERATED, AGL_DOUBLEBUFFER, AGL_NONE };


the rendering context is taken straight from the apple developer sample code project called "OpenGL Drawsprocket."

DJ Tricky S
02-21-2001, 05:58 PM
Ahh using Apple sample code, eh? well there is the problem hehe http://www.opengl.org/discussion_boards/ubb/wink.gif You need to specify depth buffer parameters in your pixel format when you are going to be using the depth buffer, like this:



// if using 32bit display ...
GLint pixel_attributes_32bit[]= {
AGL_ACCELERATED,
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_DEPTH_SIZE,
32,
AGL_NONE
};
// if using 16bit display...
GLint pixel_attributes_16bit[]= {
AGL_ACCELERATED,
AGL_RGBA,
AGL_DOUBLEBUFFER,
AGL_DEPTH_SIZE,
16,
AGL_NONE
};

G4Soon
02-21-2001, 06:37 PM
Wow, thanks! it's all good now.

All you Mac OpenGL programmers out there should check out Lunar Siege 3D at:
http://homepage.mac.com/g4soon/Downloads.html

It's the game I'm currently porting from RealBasic to C++. tell me what you think of it!

G4Soon@Mac.com