Daniel Sturk
Daniel Sturk

Reputation: 23

Set and get cursor position? JAVA w/ OpenGL

In Java /w OpenGL, how do I get and set the cursor position? A lot of people say to use GLUTWarpPointer for setting the position, but which Class is that?

Upvotes: 2

Views: 2018

Answers (1)

Michael Berry
Michael Berry

Reputation: 72274

You don't need to use OpenGL specific libraries to do this, it can easily be accomplished with the Robot class, which contains a mouseMove() method - it does what it says on the tin.

As far as I'm aware both Robot and GLUTWarpPointer generate low level system events to move the mouse, thus achieving the same thing. I assume you're using JOGL which as far as I know doesn't expose the mouse moving functionality of GLUTWarpPointer, so if that's correct Robot is probably the only sensible option.

Upvotes: 2

Related Questions