The line
glLightModeli( GL_LIGHT_MODEL_TWO_SIDE, 1 );
causes a floating point division by 0 error in my program if I am drawing in wireframe mode. I am drawing a triangle mesh using GL_TRIANGLES. I am also using call lists to draw my scene.
The error occurs when glCallList(GLuint list); is called.
If I take out the lighting model line above the problem no longer occurs. Does anyone know what might be causing this or how to fix it?
It’s actually quite normal for a GL implementation to divide by zero, the bigger problem is that your system is set to throw big exceptions when that happens.
I’ve seen these problems mostly from users of Borland C++, which throws exceptions by default. I can’t remember how you turn it of, but look for fp-control or something similiar.
yes, I am using Borland and I know how I can turn off exception but unfortunately other sections of the program I am working on relies heavily on exceptions. Thanks anyway.
This doesn’t turn off c++ exception handling, it turns off floating point exceptions. I kind of doubt you rely heavily on floating point exceptions in the rest of your code.
yeah, you’re right. I don’t need floating point exceptions. I wasn’t aware that you could just disable that type. That should fix my problem. Thanks for the help.