I stumbled across this entry in my compiler documentation (Borland C++ Builder).
“…It is recommended that you disable all floating-point exceptions when using OpenGL to render 3D graphics. To do this, call Set8087CW(0x133f) in your main form’s OnCreate event before calling any OpenGL functions.”
It’s not a problem if you run outside the Borland IDE, but the IDE halts the program
occasinally with an fp exception if you don’t
disable them. Annoying, nothing else.
Any idea as to the source of the floating point exceptions? They don’t seem to be originating in my code. Is it possibly a manifestation of a crappy MS implementation? Do any of you Linux/Unix/SGI guys have these issues?
_control87(…) doesn’t prevent BC++ from stopping execution on some FP exceptions
(that F****** dialogs like “sqrt domain error”), so I recommend also this:
Originally posted by richardve:
[b]You can also try
_clear87();
_control87(MCW_EM, MCW_EM);
before each frame is rendered, works fine for me…[/b]
Can anyone verify this? I am looking to include Borland support for GLFW ( http://hem.passagen.se/opengl/glfw/ ) in the next release, and I thought it would be a good idea to make it part of the framework so that people do not have to care about this when compiling GLFW programs for Borland.
It sounds strange that it should be done every frame to prevent errors - wouldn’t it work if we just do it before creating the GL context? Or is there some debugger or something that goes in and resets the FP register every now and then???
To disable floating point exceptions cleanly, you can simply go into project options and uncheck float point exception. If I remember well, it is in the linker tab.
Originally posted by Gorg: To disable floating point exceptions cleanly, you can simply go into project options and uncheck float point exception. If I remember well, it is in the linker tab.
And if you are writing a Makefile for the free Borland command line compiler…?