private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, GLContext.getCapabilities().OpenGL20, GLContext.getCapabilities().OpenGL21, // needed as we use GLSL 1.20 GLContext.getCapabilities().GL_ARB_framebuffer_object, // Extensions eventually included in GLContext.getCapabilities().GL_ARB_texture_float, // OpenGl 3.0 according to GLContext.getCapabilities().GL_ARB_half_float_pixel}; // http://en.wikipedia.org/wiki/OpenGL#OpenGL_3.0
protected void makeCurrent () { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { throw new RuntimeException(e); } } }
private void loop() { // This line is critical for LWJGL's interoperation with GLFW's // OpenGL context, or any context that is managed externally. // LWJGL detects the context that is current in the current thread, // creates the ContextCapabilities instance and makes the OpenGL // bindings available for use. GLContext.createFromCurrent(); // Set the clear color glClearColor(1.0f, 0.0f, 0.0f, 0.0f); // Run the rendering loop until the user has attempted to close // the window or has pressed the ESCAPE key. while ( glfwWindowShouldClose(window) == GL_FALSE ) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer glfwSwapBuffers(window); // swap the color buffers // Poll for window events. The key callback above will only be // invoked during this call. glfwPollEvents(); } }
public void releaseCurrentContext() { try { GLContext.useContext(null); _canvasCallback.releaseContext(); } catch (final LWJGLException e) { throw new RuntimeException(e); } }
private void loop() { // This line is critical for LWJGL's interoperation with GLFW's // OpenGL context, or any context that is managed externally. // LWJGL detects the context that is current in the current thread, // creates the ContextCapabilities instance and makes the OpenGL // bindings available for use. GLContext.createFromCurrent(); // Set the clear color glClearColor(1.0f, 0.0f, 0.0f, 0.0f); // Run the rendering loop until the user has attempted to close // the window or has pressed the ESCAPE key. while ( glfwWindowShouldClose(window) == GL_FALSE ) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // clear the framebuffer glfwSwapBuffers(window); // swap the color buffers // Poll for window events. The key callback above will only be // invoked during this call. glfwPollEvents(); } }
if (GLContext.getCapabilities().GL_ARB_framebuffer_object) { return GL11.glGetInteger(ARBFramebufferObject.GL_MAX_SAMPLES); } else if (GLContext.getCapabilities().GL_EXT_framebuffer_multisample) { return GL11.glGetInteger(EXTFramebufferMultisample.GL_MAX_SAMPLES_EXT); } else { pb.makeCurrent(); if (GLContext.getCapabilities().GL_ARB_framebuffer_object) { return GL11.glGetInteger(ARBFramebufferObject.GL_MAX_SAMPLES); } else if (GLContext.getCapabilities().GL_EXT_framebuffer_multisample) { return GL11.glGetInteger(EXTFramebufferMultisample.GL_MAX_SAMPLES_EXT);
protected void makeCurrent () { canvas.setCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { throw new RuntimeException(e); } } }
protected void initContextFirstTime() { if (!GLContext.getCapabilities().OpenGL20) { throw new RendererException("OpenGL 2.0 or higher is " + "required for jMonkeyEngine"); GLFbo glfbo; if (GLContext.getCapabilities().OpenGL30) { glfbo = new LwjglGLFboGL3(); } else { throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer()); if (GLContext.getCapabilities().GL_ARB_debug_output && settings.getBoolean("GraphicsDebug")) { ARBDebugOutput.glDebugMessageCallbackARB(new ARBDebugOutputCallback(new LwjglGLDebugOutputHandler()));
public void makeCurrentContext() throws Ardor3dException { try { _canvasCallback.makeCurrent(); GLContext.useContext(_context); ContextManager.switchContext(this); } catch (final LWJGLException e) { throw new Ardor3dException("Failed to claim OpenGL context.", e); } }
&& GLContext.getCapabilities().GL_ARB_multisample){ GL11.glEnable(ARBMultisample.GL_MULTISAMPLE_ARB);
GLContext.useContext(_context); } catch (final LWJGLException e) { throw new Ardor3dException("Unable to init CanvasRenderer.", e);
event.getLeft().add(" shaders.secondaryUnit: " + ConfigHandler.glSecondaryTextureUnit); ContextCapabilities caps = GLContext.getCapabilities(); event.getLeft().add(PREFIX + "OpenGL Context"); event.getLeft().add(" GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
@Override public boolean isQueryAvailable() { // glGenQueries is available only if the GL version is 1.5 or greater return GLContext.getCapabilities().OpenGL15; }
@Override public boolean isShaderAvailable() { // glCreateShader is available only if the GL version is 2.0 or greater return GLContext.getCapabilities().OpenGL20; }
@Override public boolean isTextureBarrierAvailable() { return GLContext.getCapabilities().GL_NV_texture_barrier; } }
@Override public boolean isFramebufferObjectAvailable() { return GLContext.getCapabilities().GL_ARB_framebuffer_object; }
@Override public boolean isVertexArrayAvailable() { return GLContext.getCapabilities().GL_ARB_vertex_array_object; }
public boolean canTextureMirrorClamp() { return GLContext.getCapabilities().GL_EXT_texture_mirror_clamp; }
public boolean canSecondaryColor() { return GLContext.getCapabilities().GL_EXT_secondary_color; }
private static void setup() { if (mode != null) return; ContextCapabilities contextcapabilities = GLContext.getCapabilities(); if (contextcapabilities.OpenGL30) { mode = FboMode.GL3; GL_DRAW_FRAMEBUFFER_BINDING = GL30.GL_DRAW_FRAMEBUFFER_BINDING; } else if (contextcapabilities.GL_ARB_framebuffer_object) { mode = FboMode.ARB; GL_DRAW_FRAMEBUFFER_BINDING = ARBFramebufferObject.GL_DRAW_FRAMEBUFFER_BINDING; } else if (contextcapabilities.GL_EXT_framebuffer_object) { mode = FboMode.EXT; } else { mode = FboMode.NONE; } }