@Override public void dispose() { checkMainThread(); if (DBG) log.debug("window destroy: " + title); // note: we cannot destroy window as long as the context is acquired (i.e. window is rendering) contextLock.lock(); Callbacks.glfwFreeCallbacks(window); GLFW.glfwDestroyWindow(window); window = 0; contextLock.unlock(); // XXX not sure if this is what we want in all cases, but for now ok. if (NUM_WINDOWS.decrementAndGet() == 0) Platform.get().exit(); }
public static void createDisplay() { glfwInit(); glfwSetErrorCallback(errorCallback = Callbacks.errorCallbackPrint(System.err)); glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); window = glfwCreateWindow(width, height, "", 0, 0); glfwMakeContextCurrent(window); GLContext.createFromCurrent(); glfwShowWindow(window); setCursorPosCallback(); setMouseCallback(); setKeyCallback(); if (window == 0) { throw new RuntimeException("Failed to create window"); } GL11.glViewport(0, 0, width, height); }
/** * Initialize GLFW callbacks */ private void initGLFWCallbacks() { // Set GLFW to output errors to System.err GLFW.glfwSetErrorCallback(Callbacks.errorCallbackPrint(System.err)); // Setup input callbacks WINDOW.setCursorPosCallback(Input.cursorPosCallback); WINDOW.setKeyCallback(Input.keyCallback); Input.applicationListener = applicationListener; }
public void run(){ try{ start(); render(); glfwDestroyWindow(window); }finally{ Callbacks.glfwFreeCallbacks(window); glfwTerminate(); } }
@Override public void closeDisplay() { if (!this.created) return; Callbacks.glfwFreeCallbacks(this.windowID); glfwDestroyWindow(this.windowID); this.created = false; }
public void destroy() { // Free the window callbacks and destroy the window Callbacks.glfwFreeCallbacks(this.handle); GLFW.glfwDestroyWindow(this.handle); }
public void disposeGLFW() { Callbacks.glfwFreeCallbacks(windowID); GLFW.glfwTerminate(); }
public static void destroy() { LoggerInternal.log("Destroying window"); Callbacks.glfwFreeCallbacks(nativeId); glfwDestroyWindow(nativeId); nativeId = NULL; }