org.lwjgl.opengl.GLXARBGetProcAddress Maven / Gradle / Ivy
Show all versions of lwjgl-opengl Show documentation
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.opengl;
import java.nio.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* Native bindings to the GLX_ARB_get_proc_address extension.
*
* This extension adds a function to return the address of GLX and GL extension functions, given the function name. This is necessary with (for example)
* heterogenous implementations where hardware drivers may implement extension functions not known to the link library; a similar situation on Windows
* implementations resulted in the {@code wglGetProcAddress} function.
*/
public class GLXARBGetProcAddress {
protected GLXARBGetProcAddress() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(GLXCapabilities caps) {
return checkFunctions(
caps.glXGetProcAddressARB
);
}
// --- [ glXGetProcAddressARB ] ---
/** Unsafe version of: {@link #glXGetProcAddressARB GetProcAddressARB} */
public static long nglXGetProcAddressARB(long procName) {
long __functionAddress = GL.getCapabilitiesGLXClient().glXGetProcAddressARB;
if (CHECKS) {
check(__functionAddress);
}
return callPP(__functionAddress, procName);
}
/**
* Returns the address of the extension function named by procName. The pointer returned should be cast to a function pointer type matching the extension
* function's definition in that extension specification. A return value of {@code NULL} indicates that the specified function does not exist for the
* implementation.
*
* A non-{@code NULL} return value for {@code glXGetProcAddressARB} does not guarantee that an extension function is actually supported at runtime. The client
* must must also query {@link GL11#glGetString GetString}({@link GL11#GL_EXTENSIONS}) or {@link GLX11#glXQueryExtensionsString QueryExtensionsString} to determine if an extension is supported by a particular
* context.
*
* GL function pointers returned by {@code glXGetProcAddressARB} are independent of the currently bound context and may be used by any context which
* supports the extension.
*
* {@code glXGetProcAddressARB} may be queried for all of the following functions:
*
*
* - All GL and GLX extension functions supported by the implementation (whether those extensions are supported by the current context or not).
* - All core (non-extension) functions in GL and GLX from version 1.0 up to and including the versions of those specifications supported by the
* implementation, as determined by {@link GL11#glGetString GetString}({@link GL11#GL_VERSION}) and {@link GLX#glXQueryVersion QueryVersion} queries.
*
*
* @param procName the function name to query
*/
@NativeType("void *")
public static long glXGetProcAddressARB(@NativeType("const GLchar *") ByteBuffer procName) {
if (CHECKS) {
checkNT1(procName);
}
return nglXGetProcAddressARB(memAddress(procName));
}
/**
* Returns the address of the extension function named by procName. The pointer returned should be cast to a function pointer type matching the extension
* function's definition in that extension specification. A return value of {@code NULL} indicates that the specified function does not exist for the
* implementation.
*
* A non-{@code NULL} return value for {@code glXGetProcAddressARB} does not guarantee that an extension function is actually supported at runtime. The client
* must must also query {@link GL11#glGetString GetString}({@link GL11#GL_EXTENSIONS}) or {@link GLX11#glXQueryExtensionsString QueryExtensionsString} to determine if an extension is supported by a particular
* context.
*
* GL function pointers returned by {@code glXGetProcAddressARB} are independent of the currently bound context and may be used by any context which
* supports the extension.
*
* {@code glXGetProcAddressARB} may be queried for all of the following functions:
*
*
* - All GL and GLX extension functions supported by the implementation (whether those extensions are supported by the current context or not).
* - All core (non-extension) functions in GL and GLX from version 1.0 up to and including the versions of those specifications supported by the
* implementation, as determined by {@link GL11#glGetString GetString}({@link GL11#GL_VERSION}) and {@link GLX#glXQueryVersion QueryVersion} queries.
*
*
* @param procName the function name to query
*/
@NativeType("void *")
public static long glXGetProcAddressARB(@NativeType("const GLchar *") CharSequence procName) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
ByteBuffer procNameEncoded = stack.ASCII(procName);
return nglXGetProcAddressARB(memAddress(procNameEncoded));
} finally {
stack.setPointer(stackPointer);
}
}
}