public GLCapabilities getCapabilities() { return this.capabilities; }
public GLCapabilities getCapabilities() { return (this._capabilities); }
public GLCapabilities getCapabilities() { return capabilities; }
/** * Creates a GLFW window and its OpenGL context with the specified width, * height and title. * * @param width Width of the drawing area * @param height Height of the drawing area * @param title Title of the window * @param vsync Set to true, if you want v-sync */ public Window(int width, int height, CharSequence title, boolean vsync) { this.vsync = vsync; /* Creating a temporary window for getting the available OpenGL version */ glfwDefaultWindowHints(); glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE); long temp = glfwCreateWindow(1, 1, "", NULL, NULL); glfwMakeContextCurrent(temp); GL.createCapabilities(); GLCapabilities caps = GL.getCapabilities(); glfwDestroyWindow(temp); /* Reset and set window hints */ glfwDefaultWindowHints(); if (caps.OpenGL32) { /* Hints for OpenGL 3.2 core profile */ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE); } else if (caps.OpenGL21) { /* Hints for legacy OpenGL 2.1 */ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); } else { throw new RuntimeException("Neither OpenGL 3.2 nor OpenGL 2.1 is " + "supported, you may want to update your graphics driver."); } glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE); /* Create window with specified OpenGL context */ id = glfwCreateWindow(width, height, title, NULL, NULL); if (id == NULL) { glfwTerminate(); throw new RuntimeException("Failed to create the GLFW window!"); } /* Center window on screen */ GLFWVidMode vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); glfwSetWindowPos(id, (vidmode.width() - width) / 2, (vidmode.height() - height) / 2 ); /* Create OpenGL context */ glfwMakeContextCurrent(id); GL.createCapabilities(); /* Enable v-sync */ if (vsync) { glfwSwapInterval(1); } /* Set key callback */ keyCallback = new GLFWKeyCallback() { @Override public void invoke(long window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) { glfwSetWindowShouldClose(window, true); } } }; glfwSetKeyCallback(id, keyCallback); }
/** * Get the GLCapabilities * * @return The OpenGL capabilities */ public GLCapabilities getGLCapabilities() { return glCapabilities; }
/** * Returns the GL capabilities instance of this window. If the window haven't been made current even once, then this * method returns {@code null} to the caller. * * @return The GLCapabilities instance. */ public GLCapabilities getCapabilities() { return windowCapabilities; }