LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: darkmoon on February 09, 2007, 14:55:14

Title: Division by zero in Display
Post by: darkmoon on February 09, 2007, 14:55:14
Just found this problem when switching my game to the background, and back to foreground again...

java.lang.ArithmeticException: / by zero
   at org.lwjgl.opengl.Display.sync(Display.java:394)

Am I causing this? Is this a known problem? Can it be fixed or can I make a workaround?
Title: Re: Division by zero in Display
Post by: Fool Running on February 09, 2007, 18:19:23
It looks like you passed in 0 for the fps parameter for Display.sync() (as near as I can tell by looking at the source).
I still don't think it should crash. Maybe produce a useful error message or something. ;D
Title: Re: Division by zero in Display
Post by: princec on February 09, 2007, 18:22:44
Er, that is a useful error message... I meant the only alternative is some other RuntimeException anyway isn't it ("IllegalArgumentException") so what would be the point?

Cas :)
Title: Re: Division by zero in Display
Post by: darkmoon on February 09, 2007, 20:01:47
Quote from: Fool Running on February 09, 2007, 18:19:23
It looks like you passed in 0 for the fps parameter for Display.sync()

Indeed, that was it  :-[ Not intentional of course, it was caused by putting the app in the background during the short fps test...
Title: Re: Division by zero in Display
Post by: Fool Running on February 12, 2007, 14:34:11
QuoteEr, that is a useful error message... I meant the only alternative is some other RuntimeException anyway isn't it ("IllegalArgumentException") so what would be the point?
Thats true. I guess it wouldn't gain anything. Nevermind, then :)