protected void initContextFirstTime() { final GLCapabilities capabilities = createCapabilities(settings.getRenderer().equals(AppSettings.LWJGL_OPENGL3));
/** * Enables or disables GL debug messages for the specified severity level. Returns false if the severity * level could not be set (e.g. the NOTIFICATION level is not supported by the ARB and AMD extensions). * * See {@link Lwjgl3ApplicationConfiguration#enableGLDebugOutput(boolean, PrintStream)} */ public static boolean setGLDebugMessageControl (GLDebugMessageSeverity severity, boolean enabled) { GLCapabilities caps = GL.getCapabilities(); final int GL_DONT_CARE = 0x1100; // not defined anywhere yet if (caps.OpenGL43) { GL43.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.gl43, (IntBuffer) null, enabled); return true; } if (caps.GL_KHR_debug) { KHRDebug.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.khr, (IntBuffer) null, enabled); return true; } if (caps.GL_ARB_debug_output && severity.arb != -1) { ARBDebugOutput.glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, severity.arb, (IntBuffer) null, enabled); return true; } if (caps.GL_AMD_debug_output && severity.amd != -1) { AMDDebugOutput.glDebugMessageEnableAMD(GL_DONT_CARE, severity.amd, (IntBuffer) null, enabled); return true; } return false; }
/** * <p> This method makes the OpenGL context of this window current on the calling thread. A context can only be made * current on a single thread at a time and each thread can have only a single current context at a time.</p> * * <p> By default, making a context non-current implicitly forces a pipeline flush. On machines that support * {@code GL_KHR_context_flush_control}, you can control whether a context performs this flush by setting the * {@code GLFW_CONTEXT_RELEASE_BEHAVIOR} window hint.</p> */ public void makeCurrent() { glfwMakeContextCurrent(handle); if (windowCapabilities == null) windowCapabilities = GL.createCapabilities(); else GL.setCapabilities(windowCapabilities); }
GL.createCapabilities(); if (!GL.getCapabilities().OpenGL30) { throw new RuntimeException("OpenGL 3.0 is required"); if (!GL.getCapabilities().GL_ARB_texture_multisample) { throw new RuntimeException("ARB_texture_multisample is required");
GL.setCapabilities(this.capabilities); } else { this.capabilities = GL.createCapabilities();
protected void initContextFirstTime() { final GLCapabilities capabilities = createCapabilities(!renderer.equals(AppSettings.LWJGL_OPENGL2));
GL.setCapabilities(this.capabilities); } else { this.capabilities = GL.createCapabilities();
/** * Enables or disables GL debug messages for the specified severity level. Returns false if the severity * level could not be set (e.g. the NOTIFICATION level is not supported by the ARB and AMD extensions). * * See {@link Lwjgl3ApplicationConfiguration#enableGLDebugOutput(boolean, PrintStream)} */ public static boolean setGLDebugMessageControl (GLDebugMessageSeverity severity, boolean enabled) { GLCapabilities caps = GL.getCapabilities(); final int GL_DONT_CARE = 0x1100; // not defined anywhere yet if (caps.OpenGL43) { GL43.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.gl43, (IntBuffer) null, enabled); return true; } if (caps.GL_KHR_debug) { KHRDebug.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.khr, (IntBuffer) null, enabled); return true; } if (caps.GL_ARB_debug_output && severity.arb != -1) { ARBDebugOutput.glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, severity.arb, (IntBuffer) null, enabled); return true; } if (caps.GL_AMD_debug_output && severity.amd != -1) { AMDDebugOutput.glDebugMessageEnableAMD(GL_DONT_CARE, severity.amd, (IntBuffer) null, enabled); return true; } return false; }
public void anisotropicFilter(){ if (GL.getCapabilities().GL_EXT_texture_filter_anisotropic){ float maxfilterLevel = glGetFloat(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT); glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, maxfilterLevel); } else{ System.err.println("anisotropic not supported"); } }
public void mirrorRepeatEXT(){ if (GL.getCapabilities().GL_EXT_texture_mirror_clamp){ glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_MIRROR_CLAMP_TO_EDGE_EXT); glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_MIRROR_CLAMP_TO_EDGE_EXT); } else{ System.err.println("texture mirror not supported"); } }
/** * Creates a new {@link GLCapabilities} instance for the OpenGL context that is current in the current thread. * * <p>Depending on the current context, the instance returned may or may not contain the deprecated functionality removed since OpenGL version 3.1.</p> * * <p>This method calls {@link #setCapabilities(GLCapabilities)} with the new instance before returning.</p> * * @return the GLCapabilities instance */ public static GLCapabilities createCapabilities() { return createCapabilities(false); }
/** * Queries the specified parameter of the specified texture object level. If direct-state-access functionality is not available, the texture must be * currently bound to the specified texture target. * * @param texture the texture object * @param target the texture target * @param level the texture level * @param pname the parameter to query * * @return the parameter value */ static int getTexLevelParameteri(int texture, int target, int level, int pname) { GLCapabilities caps = GL.getCapabilities(); if (caps.OpenGL45) { return GL45.glGetTextureLevelParameteri(texture, level, pname); } if (caps.GL_ARB_direct_state_access) { return ARBDirectStateAccess.glGetTextureLevelParameteri(texture, level, pname); } if (caps.GL_EXT_direct_state_access) { return EXTDirectStateAccess.glGetTextureLevelParameteriEXT(texture, target, level, pname); } return glGetTexLevelParameteri(target, level, pname); }
@MainThread protected ContextCapabilities createContextCapabilities() { return new Lwjgl3ContextCapabilities(GL.createCapabilities()); }
/** * Enables or disables GL debug messages for the specified severity level. Returns false if the severity * level could not be set (e.g. the NOTIFICATION level is not supported by the ARB and AMD extensions). * * See {@link Lwjgl3ApplicationConfiguration#enableGLDebugOutput(boolean, PrintStream)} */ public static boolean setGLDebugMessageControl (GLDebugMessageSeverity severity, boolean enabled) { GLCapabilities caps = GL.getCapabilities(); final int GL_DONT_CARE = 0x1100; // not defined anywhere yet if (caps.OpenGL43) { GL43.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.gl43, (IntBuffer) null, enabled); return true; } if (caps.GL_KHR_debug) { KHRDebug.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, severity.khr, (IntBuffer) null, enabled); return true; } if (caps.GL_ARB_debug_output && severity.arb != -1) { ARBDebugOutput.glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, severity.arb, (IntBuffer) null, enabled); return true; } if (caps.GL_AMD_debug_output && severity.amd != -1) { AMDDebugOutput.glDebugMessageEnableAMD(GL_DONT_CARE, severity.amd, (IntBuffer) null, enabled); return true; } return false; }
public void wrapNewContext() { if(cc instanceof JAWTContextCreator) ((JAWTContextCreator)cc).makeCurrent(true); if(context != null) context.disposeAll(); GLCapabilities caps = GL.createCapabilities(); if(caps.OpenGL20) { context = new LWJGL20DrawContext(caps, debug); } else if(caps.OpenGL15 && caps.GL_ARB_texture_non_power_of_two) { context = new LWJGL15DrawContext(caps, debug); } else { context = null; errorGLVersion(); } }
@NativeType("void") public static String glGetTransformFeedbackVaryingEXT(@NativeType("GLuint") int program, @NativeType("GLuint") int index, @NativeType("GLsizei *") IntBuffer size, @NativeType("GLenum *") IntBuffer type) { return glGetTransformFeedbackVaryingEXT(program, index, GL.getCapabilities().OpenGL20 ? GL20.glGetProgrami(program, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT) : ARBShaderObjects.glGetObjectParameteriARB(program, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT), size, type); }