LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Eckelf on July 20, 2013, 22:18:00

Title: StackOverflowError after Display.update()
Post by: Eckelf on July 20, 2013, 22:18:00
Hi there!

I am currently learning how to use OpenGL (through LWJGL). Things go pretty well but there is one major issue I have at the moment:
At some random point after startup a StackOverflowError occurs after calling Display.update(), as seen here: http://pastebin.com/eu1VeNV5 (http://pastebin.com/eu1VeNV5).
I'm using a recursive render method that first calls Display.sync(60) and then Display.update().

Is this something someone has experienced before? Any ideas if that is a problem on my end or on LWJGL's?
Title: Re: StackOverflowError after Display.update()
Post by: quew8 on July 21, 2013, 10:08:36
I'm not sure how you can have a recursive render method, but that is definitely your problem. If recursive methods don't have a way of stopping themselves after a while, then they just keep adding to the call stack and it inevitably overflows. A loop is what you want, but please show some code, because I would sure like to see what you have.
Title: Re: StackOverflowError after Display.update()
Post by: Eckelf on July 21, 2013, 16:27:06
That might be the problem then! I didn't think it was because it is running in its own thread, but it has not happened since I changed it to a loop.
Thanks for the advice! I will report back if it occurs again.