LWJGL3’s “window manipulation interface” is a bit more convoluted compared to LWJGL2. I’ve always thought it would be nice if JME had some utility methods to make using 3 a bit easier.
But I’m on the fence about whether this should even be a JME responsibility.
To illustrate what I mean by “convoluted”, relatively speaking:
LWJGL2:
Display.setLocation(windowX, windowY);
Simple interface:
public static void setLocation(int new_x, int new_y);
LWJGL3:
‘context’ is a JmeContext. I know this could be written more concisely, but it would still be a nuisance.
LwjglWindow lwjglContext = (LwjglWindow) context;
long winHandle = lwjglContext.getWindowHandle();
GLFW.glfwSetWindowPos(winHandle, windowX, windowY);
Interface:
public static void glfwSetWindowPos(long window, int xpos, int ypos);
This is one of the less annoying differences. Getting window position or size is worse. You need to pass two IntBuffers to capture the window width/height values, for example:
public static void glfwGetWindowSize(long window, IntBuffer width, IntBuffer height);
(And if you’re calling this frequently, now you’re either creating extra garbage with those buffers, or you have to keep them around to re-use.)
None of this is a problem; it’s just a slight annoyance and inconvenience–another reason I’m not sure it’s worth putting in JME.
Another idea, apart from a simple LWJGL3 utility class, is to have JME provide a standard interface which LWJGL2, LWJGL3, and JOGL could all implement. I imagine it would look similar to parts of LWJGL2’s Display class (static methods with minimal parameters).
It was suggested that I ask here to solicit some additional opinions on whether this is worth adding.
…Any thoughts?