GL_LIGHT_MODEL_TWO_SIDE error with wireframe drawing

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?

Where does the division by 0 occur exactly? In which module? It might well be a driver bug. Regards.

[This message has been edited by Asgard (edited 08-20-2002).]

It happens in my call to glCallList. I couldn’t step into that function for some reason.

What are the parameters for ligting you used?

Try a basic scene with a single line and one directional lights.

In the lighting equation, it is possible to have
a division by zero if your not careful.


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.

In Delphi, I think the function is Set8087CW. In C++ the function call is _control87(MCW_EM,MCW_EM);

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.