private static ByteBuffer transformCursorImage(final IntBuffer imageData, final int width, final int height,
                                                   final int index) {

        final ByteBuffer byteBuffer = BufferUtils.createByteBuffer(width * height * 4);

        // Transform image: ARGB -> RGBA, vertical flip
        for (int y = height - 1; y >= 0; --y) {
            for (int x = 0; x < width; ++x) {
                int pixel = imageData.get(width * height * index + y * width + x);
                byteBuffer.put((byte) ((pixel >> 16) & 0xFF));  // red
                byteBuffer.put((byte) ((pixel >> 8) & 0xFF));   // green
                byteBuffer.put((byte) (pixel & 0xFF));          // blue
                byteBuffer.put((byte) ((pixel >> 24) & 0xFF));  // alpha
            }
        }

        byteBuffer.flip();

        return byteBuffer;
    }
Captures mouse input using GLFW callbacks. It then temporarily stores these
in event queues which are processed in the {@link #update()} method. Due to
some of the GLFW button IDs, there is a conversion method in this class which
will convert the GLFW left, middle and right mouse button to JME3 left,
middle and right button codes.

@author Daniel Johansson (dannyjo)
@since 3.1
jme3-lwjgl3/src/main/java/com/jme3/input/lwjgl/GlfwMouseInput.java