Reputation: 415
I am using JOGL to render some models. I can implement the KeyListener interface and receive the keystrokes accordingly. But the problem is, I cannot refresh or render the model again after the key press. I can recieve the input but how do I clear the buffer again render it again after each key stroke in JOGL.
Upvotes: 1
Views: 613
Reputation: 1582
I'm using Animator rather than FPSAnimator with my KeyListener canvas - I haven't quite figured out why (a lock on the surface, maybe?) but it wasn't updating the movements from my key press actions until a reshape call until I switched from the frame/second animator.
Upvotes: 0
Reputation: 243
During the program load, init() > reshape() > display() methods are called respectively.Every reshape() method call, causes display() method to be executed as well.
In your case, apparently you are not calling display method on key event.You can either call display method right after handling user input or creating an FPSAnimator class instance for the canvas.When you start the animation by calling animator.start() display method will be called at a certain speed in background.Speed(fps) can also can be specified. This link has a detailed explanation an samples for your case. https://sites.google.com/site/justinscsstuff/jogl-tutorial-3
Upvotes: 0
Reputation: 7190
Don't do that.
Add the jogl (com.jogamp.newt.event.KeyListener
) keyListener, like here.
Then play with these two methods
Upvotes: 1