Hello Guest

StackOverflowError after Display.update()

  • 2 Replies
  • 2564 Views
StackOverflowError after Display.update()
« 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.
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?

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: StackOverflowError after Display.update()
« Reply #1 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.

Re: StackOverflowError after Display.update()
« Reply #2 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.