Copyright | (c) Sven Panne 2016 |
---|---|
License | BSD3 |
Maintainer | Sven Panne <svenpanne@gmail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
This module offers a portable way to retrieve OpenGL functions and extension
entries, providing a portability layer upon platform-specific mechanisms
like glXGetProcAddress
, wglGetProcAddress
or NSAddressOfSymbol
.
Note that finding an OpenGL entry point doesn't mean that it's actually usable: On most platforms entry points are context-independent, so you have to check the available extensions and/or OpenGL version, too.
- getProcAddress :: MonadIO m => String -> m (FunPtr a)
- getProcAddressWithSuffixes :: MonadIO m => String -> [String] -> m (FunPtr a)
- getExtension :: MonadIO m => String -> m (FunPtr a)
- getProcAddressChecked :: MonadIO m => String -> m (FunPtr a)
- getProcAddressWithSuffixesChecked :: MonadIO m => String -> [String] -> m (FunPtr a)
- getExtensionChecked :: MonadIO m => String -> m (FunPtr a)
- getVersion :: MonadIO m => m (Int, Int)
- version :: (Int, Int)
- getExtensions :: MonadIO m => m (Set String)
- extensions :: Set String
Unchecked retrieval
getProcAddress :: MonadIO m => String -> m (FunPtr a) Source #
Retrieve an OpenGL function by name. Returns nullFunPtr
when no function
with the given name was found.
getProcAddressWithSuffixes :: MonadIO m => String -> [String] -> m (FunPtr a) Source #
Retrieve an OpenGL function by name, trying a list of name suffixes in the
given order. Returns nullFunPtr
when no function with the given name plus
any of the suffixes was found.
getExtension :: MonadIO m => String -> m (FunPtr a) Source #
Retrieve an OpenGL function by name, additionally trying a list of all
known vendor suffixes. Returns nullFunPtr
when no function with the given
name plus any of the suffixes was found.
Checked retrieval
getProcAddressChecked :: MonadIO m => String -> m (FunPtr a) Source #
Retrieve an OpenGL function by name. Throws an userError
when no function
with the given name was found.
getProcAddressWithSuffixesChecked :: MonadIO m => String -> [String] -> m (FunPtr a) Source #
Retrieve an OpenGL function by name, trying a list of name suffixes in the
given order. Throws an userError
when no function with the given name plus
any of the suffixes was found.
getExtensionChecked :: MonadIO m => String -> m (FunPtr a) Source #
Retrieve an OpenGL function by name, additionally trying a list of all
known vendor suffixes. Throws an userError
when no function with the given
name plus any of the suffixes was found.
Version info and extensions
getVersion :: MonadIO m => m (Int, Int) Source #
Retrieve the OpenGL version, split into major and minor version numbers.
version :: (Int, Int) Source #
The OpenGL version, split into major and minor version numbers. Note that
in the presence of multiple contexts with different capabilities, this might
be wrong. Use getVersion
in those cases instead.
getExtensions :: MonadIO m => m (Set String) Source #
Retrieve the set of all available OpenGL extensions.
extensions :: Set String Source #
The set of all available OpenGL extensions. Note that in the presence of
multiple contexts with different capabilities, this might be wrong. Use
getExtensions
in those cases instead.