Graphics.UI.Gtk.Gdk.GLContext

gtk3-0.14.6: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.Gdk.GLContext

Contents

- Detail
- Class Hierarchy
- Types
- Methods

Description

OpenGL context

Synopsis

- data GLContext
- class GObjectClass o => GLContextClass o
- castToGLContext :: GObjectClass obj => obj -> GLContext
- gTypeGLContext :: GType
- glContextGetDisplay :: GLContextClass self => self -> IO (Maybe Display)
- glContextGetWindow :: GLContextClass self => self -> IO (Maybe DrawWindow)
- glContextGetSharedContext :: GLContextClass self => self -> IO (Maybe GLContext)
- glContextGetVersion :: GLContextClass self => self -> IO (Int, Int)
- glContextSetRequiredVersion :: GLContextClass self => self -> Int -> Int -> IO ()
- glContextGetRequiredVersion :: GLContextClass self => self -> IO (Int, Int)
- glContextSetDebugEnabled :: GLContextClass self => self -> Bool -> IO ()
- glContextGetDebugEnabled :: GLContextClass self => self -> IO Bool
- glContextSetForwardCompatible :: GLContextClass self => self -> Bool -> IO ()
- glContextGetForwardCompatible :: GLContextClass self => self -> IO Bool
- glContextRealize :: GLContextClass self => self -> IO Bool
- glContextIsLegacy :: GLContextClass self => self -> IO Bool
- glContextMakeCurrent :: GLContextClass self => self -> IO ()
- glContextGetCurrent :: IO (Maybe GLContext)
- glContextClearCurrent :: IO ()

# Detail

GLContext is an object representing the platform-specific OpenGL drawing context.

GLContexts are created for a GdkWindow, and the context will match the GdkVisual of the window.

A `GLContext` is not tied to any particular normal framebuffer. For instance, it cannot draw to the Window back buffer. The GDK repaint system is in full control of the painting to that. GDK will handle the integration of your rendering with that of other widgets.

Support for `GLContext` is platform-specific, context creation can fail, returning NULL context.

A `GLContext` has to be made "current" in order to start using it, otherwise any OpenGL call will be ignored.

# Class Hierarchy

    | GObject
    | +----GLContext

# Types

data GLContext #

Instances

Eq GLContext # |
Methods (==) :: GLContext -> GLContext -> Bool # (/=) :: GLContext -> GLContext -> Bool #
Ord GLContext # |
Methods compare :: GLContext -> GLContext -> Ordering # (<) :: GLContext -> GLContext -> Bool # (<=) :: GLContext -> GLContext -> Bool # (>) :: GLContext -> GLContext -> Bool # (>=) :: GLContext -> GLContext -> Bool # max :: GLContext -> GLContext -> GLContext # min :: GLContext -> GLContext -> GLContext #
GObjectClass GLContext # |
Methods toGObject :: GLContext -> GObject # unsafeCastGObject :: GObject -> GLContext #
GLContextClass GLContext # |

class GObjectClass o => GLContextClass o #

Instances

GLContextClass GLContext # |

castToGLContext :: GObjectClass obj => obj -> GLContext #

gTypeGLContext :: GType #

# Methods

glContextGetDisplay :: GLContextClass self => self -> IO (Maybe Display) #

Retrieves the `Display` the context is created for.

glContextGetWindow :: GLContextClass self => self -> IO (Maybe DrawWindow) #

Retrieves the `DrawWindow` used by the context.

glContextGetSharedContext :: GLContextClass self => self -> IO (Maybe GLContext) #

Retrieves the `GLContext` that this context share data with.

glContextGetVersion :: GLContextClass self => self -> IO (Int, Int) #

Retrieves the OpenGL version of the context.

The context must be realized prior to calling this function.

glContextSetRequiredVersion :: GLContextClass self => self -> Int -> Int -> IO () #

Sets the major and minor version of OpenGL to request.

Setting major and minor to zero will use the default values.

The `GLContext` must not be realized or made current prior to calling this function.

glContextGetRequiredVersion :: GLContextClass self => self -> IO (Int, Int) #

Retrieves the major and minor version requested by calling `glContextSetRequiredVersion`.

glContextSetDebugEnabled :: GLContextClass self => self -> Bool -> IO () #

Sets whether the `GLContext` should perform extra validations and run time checking. This is useful during development, but has additional overhead.

The `GLContext` must not be realized or made current prior to calling this function.

glContextGetDebugEnabled :: GLContextClass self => self -> IO Bool #

Retrieves the value set using glContextSetDebugEnabled.

glContextSetForwardCompatible :: GLContextClass self => self -> Bool -> IO () #

Sets whether the `GLContext` should be forward compatible.

Forward compatibile contexts must not support OpenGL functionality that has been marked as deprecated in the requested version; non-forward compatible contexts, on the other hand, must support both deprecated and non deprecated functionality.

The `GLContext` must not be realized or made current prior to calling this function.

glContextGetForwardCompatible :: GLContextClass self => self -> IO Bool #

Retrieves the value set using glContextSetForwardCompatible.

glContextRealize :: GLContextClass self => self -> IO Bool #

Realizes the given `GLContext`.

It is safe to call this function on a realized `GLContext`.

glContextIsLegacy :: GLContextClass self => self -> IO Bool #

Whether the `GLContext` is in legacy mode or not.

The `GLContext` must be realized before calling this function.

When realizing a GL context, GDK will try to use the OpenGL 3.2 core profile; this profile removes all the OpenGL API that was deprecated prior to the 3.2 version of the specification. If the realization is successful, this function will return False.

If the underlying OpenGL implementation does not support core profiles, GDK will fall back to a pre-3.2 compatibility profile, and this function will return True.

You can use the value returned by this function to decide which kind of OpenGL API to use, or whether to do extension discovery, or what kind of shader programs to load.

glContextMakeCurrent :: GLContextClass self => self -> IO () #

Makes the context the current one.

glContextGetCurrent :: IO (Maybe GLContext) #

Retrieves the current `GLContext`.

glContextClearCurrent :: IO () #

Clears the current `GLContext`.

Any OpenGL call after this function returns will be ignored until glContextMakeCurrent is called.