PDA

View Full Version : LIGHTING Crash



10-12-2000, 01:00 AM
I have made a scene with some objets. The first time I display it with color tracking and ligthing enable, it works perfectly. But when I made some transformations like (rotation), the programm crashs and I have a message error that says there has been an exception in OpenGl32.dll. Ok but when I do not use LIGHTNING the programm is able to do the transformations!?

Here is the function that initialize lighting and colour tracking :

void initBodyModel(void)
{
glClearColor(1,1,1,0);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glColorMaterial(GL_FRONT,GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
}

Goober
10-12-2000, 02:57 AM
Do you have GL_NORMALIZE enabled ?? is it possible that your transforms are somehow causing your normals to have zero length, then when OGL attempts to normalize them you get a divide by zero exception ??

one way to check would be to look at the length of the axes described in the rotation matrix.

HTH

Goober
10-12-2000, 03:02 AM
actually, the square root would screw up, before we get around to the divide...but whatever, it would break...

tdavie
10-12-2000, 04:08 AM
Have you set up any attributes for the lighting?
:P

10-13-2000, 12:54 PM
Thanks a lot! It was a scalef problem. Some spheres were too small to draw with lighting enable.