glfwGetCursorPos usage

Started by SmartVirtue, December 01, 2014, 17:19:21

Previous topic - Next topic

SmartVirtue

Hello, im Serge and im porting game from C# to java using lwjgl 3
i need to get cursor(mouse) position i found that glfwGetCurcorPos can do it.
so i use this :

ByteBuffer x = ByteBuffer.allocate(8);
ByteBuffer y = ByteBuffer.allocate(8);
GLFW.glfwGetCursorPos(AntiheusLab.window , x , y);


and i get 0 in x and 0 in y. ofc it can be a bug because same(adapted) code workin in c#

spasi

You have to use direct buffers. The easiest method is:

ByteBuffer x = BufferUtils.createByteBuffer(8);
// or
DoubleBuffer x = BufferUtils.createDoubleBuffer(1);

The BufferUtils class documentation contains more information.

SmartVirtue

Quote from: spasi on December 01, 2014, 18:57:23
You have to use direct buffers. The easiest method is:

ByteBuffer x = BufferUtils.createByteBuffer(8);
// or
DoubleBuffer x = BufferUtils.createDoubleBuffer(1);

The BufferUtils class documentation contains more information.

thank you!!!