package engine.test;import static org.lwjgl.glfw.GLFW.*;import static org.lwjgl.opengl.GL11.*;import org.lwjgl.glfw.GLFWCursorPosCallback;import org.lwjgl.glfw.GLFWErrorCallback;import org.lwjgl.opengl.GL;import org.lwjgl.system.MemoryUtil;public class GLFWCursorTest { public static GLFWErrorCallback errorCallback; public static GLFWCursorPosCallback cursorCallback; public static void main(String[] args) { glfwSetErrorCallback(errorCallback = new GLFWErrorCallback(){ @Override public void invoke(int error, long description) { System.err.println("GLFW error occured"); System.err.println("\t" + MemoryUtil.memDecodeUTF8(description)); System.err.println("Stack trace:"); StackTraceElement[] stack = Thread.currentThread().getStackTrace(); for(int i = 4; i < stack.length; i++){ System.err.println(stack[i]); } System.err.println(); } }); glfwInit(); glfwDefaultWindowHints(); long window = glfwCreateWindow(1024, 768, "Test window", 0, 0); glfwMakeContextCurrent(window); GL.createCapabilities(); glfwSetCursorPosCallback(window, cursorCallback = new GLFWCursorPosCallback() { @Override public void invoke(long window, double xpos, double ypos) { System.out.println(xpos + ", " + ypos); } }); while(glfwWindowShouldClose(window) != GL_TRUE){ glClear(GL_COLOR_BUFFER_BIT); glfwSwapBuffers(window); glfwPollEvents(); } }}
## A fatal error has been detected by the Java Runtime Environment:## EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006f757a4c, pid=5360, tid=4668## JRE version: Java(TM) SE Runtime Environment (8.0_20-b10) (build 1.8.0_20-ea-b10)# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.20-b10 mixed mode windows-amd64 compressed oops)# Problematic frame:# V [jvm.dll+0x137a4c]## Failed to write core dump. Minidumps are not enabled by default on client versions of Windows## An error report file with more information is saved as:# C:\Users\Test\git\WSW\WSWTest\hs_err_pid5360.log## If you would like to submit a bug report, please visit:# http://bugreport.sun.com/bugreport/crash.jsp#