void render()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -5.0f);
glBegin(GL_TRIANGLES);
glVertex3i( 0, 1, 5);
glVertex3i(-1,-1, 5);
glVertex3i( 1,-1, 5);
glEnd();
SwapBuffers(hDC);
}
[edited by - angry on October 22, 2003 8:49:39 AM]
glVertex3i [division by zero exception]
Argh... my rendering code throws a division by zero exception caused by a call to glVertex3i.
The code looks like this:
Are you using Borland C++ compiler? If yes try resetting the FPU state before any gl call:
_control87(MCW_EM, MCW_EM);
this func is found in float.h
If you're not using Borland, well, ignore the above comment
Regards
-Lev
[edited by - Lev Povalahev on October 22, 2003 12:16:37 PM]
_control87(MCW_EM, MCW_EM);
this func is found in float.h
If you're not using Borland, well, ignore the above comment
Regards
-Lev
[edited by - Lev Povalahev on October 22, 2003 12:16:37 PM]
Maybe it''s the Z divide. Make sure you''re the matrix mode is GL_MODELVIEW before you enter your render function, and make sure the projection matrix is set properly, using gluPerspective or whatever.
quote:
Are you using Borland C++ compiler? If yes try resetting the FPU state before any gl call:
_control87(MCW_EM, MCW_EM);
this func is found in float.h
Yep im using a Borland C++ Compiler. And it worked, thanks!
Probably this simply disables math-exception...I think that problem is not here; note that you get no exception in release version (at least in VC++...) but exceptions are useful not evil!!!
quote:Original post by benjamin bunny
Maybe it''s the Z divide. Make sure you''re the matrix mode is GL_MODELVIEW before you enter your render function, and make sure the projection matrix is set properly, using gluPerspective or whatever.
quote:Original post by blizzard999
Probably this simply disables math-exception...I think that problem is not here; note that you get no exception in release version (at least in VC++...) but exceptions are useful not evil!!!
You get no exceptions in VC because MS disables FPU exceptions by default, whereas Borland does not, so to ensure compatibility you must do this yourself.
Regards
-Lev
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement