glfwExtensionSupported function
! @brief Returns whether the specified extension is available.
This function returns whether the specified
API extension
(@ref context_glext) is supported by the current OpenGL or
OpenGL ES context. It searches both for client API extension and context
creation API extensions.
A context must be current on the calling thread. Calling this function without a current context will cause a @ref GLFW_NO_CURRENT_CONTEXT error.
As this functions retrieves and searches one or more extension strings each call, it is recommended that you cache its results if it is going to be used frequently. The extension strings will not change during the lifetime of a context, so there is no danger in doing this.
This function does not apply to Vulkan. If you are using Vulkan, see @ref
glfwGetRequiredInstanceExtensions, vkEnumerateInstanceExtensionProperties
and vkEnumerateDeviceExtensionProperties
instead.
@paramin
extension The ASCII encoded name of the extension.
@return GLFW_TRUE
if the extension is available, or GLFW_FALSE
otherwise.
@errors Possible errors include @ref GLFW_NOT_INITIALIZED, @ref GLFW_NO_CURRENT_CONTEXT, @ref GLFW_INVALID_VALUE and @ref GLFW_PLATFORM_ERROR.
@thread_safety This function may be called from any thread.
@sa @ref context_glext @sa @ref glfwGetProcAddress
@since Added in version 1.0.
@ingroup context
GLFWAPI int glfwExtensionSupported(const char* extension)
Implementation
int glfwExtensionSupported(String extension) {
final glfwExtensionSupportedLookupFunction = libglfw.lookupFunction<
Int32 Function(Pointer<Utf8> extension),
int Function(Pointer<Utf8> extension)>('glfwExtensionSupported');
final extensionPointer = extension.toNativeUtf8();
final result = glfwExtensionSupportedLookupFunction(extensionPointer);
calloc.free(extensionPointer);
return result;
}