0

How to implement such rendering mode, when a frame is drawn only when requested (or, maybe, also when a key is pressed or the mouse is moved) instead of re-rendering frames all the time?

I saw that this is possible on Android (https://stackoverflow.com/a/4331643/1418097), so I think there should be a way to do this on desktop, too.

And it would be especially cool to do this in LWJGL.

Community
  • 1
  • 1
Display Name
  • 8,022
  • 3
  • 31
  • 66

1 Answers1

2

Just draw a frame as you normally would; i.e. run your glDraw* commands and finish with a SwapBuffers (or whatever the equivalent LWJGL function is).

The only reason most apps run constantly is because they put the above in an infinite loop, which continuously renders as long as the app is active. If you have no such loop, it won't render continuously, and you can render your frames in response to events instead.

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85