sdl2-2.2.0: Both high- and low-level bindings to the SDL library (version 2.0.4+).

Safe HaskellNone
LanguageHaskell2010

SDL.Video.OpenGL

Contents

Synopsis

Creating and Configuring OpenGL Contexts

data OpenGLConfig #

Configuration used when creating an OpenGL rendering context.

Constructors

OpenGLConfig 

Fields

Instances

Eq OpenGLConfig # 
Ord OpenGLConfig # 
Read OpenGLConfig # 
Show OpenGLConfig # 
Generic OpenGLConfig # 

Associated Types

type Rep OpenGLConfig :: * -> * #

type Rep OpenGLConfig # 

data GLContext #

A created OpenGL context.

Instances

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

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 #

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

Instances

Eq Profile # 

Methods

(==) :: Profile -> Profile -> Bool #

(/=) :: Profile -> Profile -> Bool #

Ord Profile # 
Read Profile # 
Show Profile # 
Generic Profile # 

Associated Types

type Rep Profile :: * -> * #

Methods

from :: Profile -> Rep Profile x #

to :: Rep Profile x -> Profile #

type Rep Profile # 

data Mode #

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

Instances

Bounded Mode # 
Enum Mode # 

Methods

succ :: Mode -> Mode #

pred :: Mode -> Mode #

toEnum :: Int -> Mode #

fromEnum :: Mode -> Int #

enumFrom :: Mode -> [Mode] #

enumFromThen :: Mode -> Mode -> [Mode] #

enumFromTo :: Mode -> Mode -> [Mode] #

enumFromThenTo :: Mode -> Mode -> Mode -> [Mode] #

Eq Mode # 

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Data Mode # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Mode -> c Mode #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Mode #

toConstr :: Mode -> Constr #

dataTypeOf :: Mode -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Mode) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Mode) #

gmapT :: (forall b. Data b => b -> b) -> Mode -> Mode #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Mode -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Mode -> r #

gmapQ :: (forall d. Data d => d -> u) -> Mode -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Mode -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Mode -> m Mode #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Mode -> m Mode #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Mode -> m Mode #

Ord Mode # 

Methods

compare :: Mode -> Mode -> Ordering #

(<) :: Mode -> Mode -> Bool #

(<=) :: Mode -> Mode -> Bool #

(>) :: Mode -> Mode -> Bool #

(>=) :: Mode -> Mode -> Bool #

max :: Mode -> Mode -> Mode #

min :: Mode -> Mode -> Mode #

Read Mode # 
Show Mode # 

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

Generic Mode # 

Associated Types

type Rep Mode :: * -> * #

Methods

from :: Mode -> Rep Mode x #

to :: Rep Mode x -> Mode #

type Rep Mode # 
type Rep Mode = D1 (MetaData "Mode" "SDL.Video.OpenGL" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" False) ((:+:) (C1 (MetaCons "Normal" PrefixI False) U1) (C1 (MetaCons "Debug" PrefixI False) U1))

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

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 () #

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.

Querying for the drawable size without a Renderer

glGetDrawableSize :: MonadIO m => Window -> m (V2 CInt) #

Get the size of a window's underlying drawable area in pixels (for use with glViewport).

Swapping

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

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

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 #

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 

Instances

Bounded SwapInterval # 
Enum SwapInterval # 
Eq SwapInterval # 
Data SwapInterval # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SwapInterval -> c SwapInterval #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SwapInterval #

toConstr :: SwapInterval -> Constr #

dataTypeOf :: SwapInterval -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c SwapInterval) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SwapInterval) #

gmapT :: (forall b. Data b => b -> b) -> SwapInterval -> SwapInterval #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SwapInterval -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SwapInterval -> r #

gmapQ :: (forall d. Data d => d -> u) -> SwapInterval -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SwapInterval -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SwapInterval -> m SwapInterval #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SwapInterval -> m SwapInterval #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SwapInterval -> m SwapInterval #

Ord SwapInterval # 
Read SwapInterval # 
Show SwapInterval # 
Generic SwapInterval # 

Associated Types

type Rep SwapInterval :: * -> * #

ToNumber SwapInterval CInt # 
FromNumber SwapInterval CInt # 
type Rep SwapInterval # 
type Rep SwapInterval = D1 (MetaData "SwapInterval" "SDL.Video.OpenGL" "sdl2-2.2.0-2P34LP7wP7h1axXaFF2L0F" False) ((:+:) (C1 (MetaCons "ImmediateUpdates" PrefixI False) U1) ((:+:) (C1 (MetaCons "SynchronizedUpdates" PrefixI False) U1) (C1 (MetaCons "LateSwapTearing" PrefixI False) U1)))

swapInterval :: StateVar SwapInterval #

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