sdl2-2.1.0: Both high- and low-level bindings to the SDL library (version 2.0.3).

Safe HaskellNone
LanguageHaskell2010

SDL.Video.OpenGL

Contents

Synopsis

Creating and Configuring OpenGL Contexts

data OpenGLConfig Source

Configuration used when creating an OpenGL rendering context.

Constructors

OpenGLConfig 

Fields

glColorPrecision :: V4 CInt

Defaults to V4 8 8 8 0.

glDepthPrecision :: CInt

Defaults to 24.

glStencilPrecision :: CInt

Defaults to 8.

glProfile :: Profile

Defaults to Compatibility Normal 2 1.

data GLContext Source

A created OpenGL context.

Instances

glCreateContext :: (Functor m, MonadIO m) => Window -> m GLContext Source

Create a new OpenGL context and makes it the current context for the window.

Throws SDLException if the window wasn't configured with OpenGL support, or if context creation fails.

See SDL_GL_CreateContext for C documentation.

data Profile Source

The profile a driver should use when creating an OpenGL context.

Constructors

Core Mode CInt CInt

Use the OpenGL core profile, with a given major and minor version

Compatibility Mode CInt CInt

Use the compatibilty profile with a given major and minor version. The compatibility profile allows you to use deprecated functions such as immediate mode

ES Mode CInt CInt

Use an OpenGL profile for embedded systems

data Mode Source

The mode a driver should use when creating an OpenGL context.

Constructors

Normal

A normal profile with no special debugging support

Debug

Use a debug context, allowing the usage of extensions such as GL_ARB_debug_output

glMakeCurrent :: (Functor m, MonadIO m) => Window -> GLContext -> m () Source

Set up an OpenGL context for rendering into an OpenGL window.

Throws SDLException on failure.

See SDL_GL_MakeCurrent for C documentation.

glDeleteContext :: MonadIO m => GLContext -> m () Source

Delete the given OpenGL context.

You must make sure that there are no pending commands in the OpenGL command queue, the driver may still be processing commands even if you have stopped issuing them!

The glFinish command will block until the command queue has been fully processed. You should call that function before deleting a context.

See SDL_GL_DeleteContext for C documentation.

Swapping

The process of "swapping" means to move the back-buffer into the window contents itself.

glSwapWindow :: MonadIO m => Window -> m () Source

Replace the contents of the front buffer with the back buffer's. The contents of the back buffer are undefined, clear them with glClear or equivalent before drawing to them again.

See SDL_GL_SwapWindow for C documentation.

data SwapInterval Source

The swap interval for the current OpenGL context.

Constructors

ImmediateUpdates

No vertical retrace synchronization

SynchronizedUpdates

The buffer swap is synchronized with the vertical retrace

LateSwapTearing 

swapInterval :: StateVar SwapInterval Source

Get or set the swap interval for the current OpenGL context.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_GL_SetSwapInterval and SDL_GL_GetSwapInterval for C documentation.

Function Loading