View Full Version : GL_LIGHT_MODEL_TWO_SIDE error with wireframe drawing
08-20-2002, 12:41 PM
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?
08-20-2002, 01:06 PM
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).]
08-20-2002, 02:47 PM
It happens in my call to glCallList. I couldn't step into that function for some reason.
08-20-2002, 06:48 PM
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.
08-21-2002, 03:20 AM
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.
08-21-2002, 05:05 AM
In Delphi, I think the function is Set8087CW. In C++ the function call is _control87(MCW_EM,MCW_EM);
08-21-2002, 02:12 PM
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.
08-22-2002, 02:27 PM
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.
08-23-2002, 08:09 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.