Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
A widget for custom drawing with OpenGL
Detail
The GLArea
is a widget that allows drawing with OpenGL.
GLArea sets up its own GLContext
for the window it creates, and creates a
custom GL framebuffer that the widget will do GL rendering onto. It also
ensures that this framebuffer is the default GL rendering target when
rendering.
In order to draw, you have to connect to the glAreaRender
signal.
The GLArea widget ensures that the GLContext
is associated with the
widget's drawing area, and it is kept updated when the size and position
of the drawing area changes.
If you need to initialize OpenGL state, e.g. buffer objects or shaders,
you should use the realize
signal; you can use the unrealize
signal
to clean up.
To receive mouse events on a drawing area, you will need to enable them
with widgetAddEvents
. To receive keyboard events, you will need to set the
widgetCanFocus
attribute on the drawing area.