{-# LINE 2 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -- -*-haskell-*- -- GIMP Toolkit (GTK) Widget GLArea -- -- Author : Chris Mennie -- -- Created: 23 April 2016 -- -- Copyright (C) 2016 Chis Mennie -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Lesser General Public License for more details. -- -- | -- Maintainer : gtk2hs-users@lists.sourceforge.net -- Stability : provisional -- Portability : portable (depends on GHC) -- -- A widget for custom drawing with OpenGL -- module Graphics.UI.Gtk.Misc.GLArea ( -- * Detail -- -- | The 'GLArea' is a widget that allows drawing with OpenGL. -- -- GLArea sets up its own 'Graphics.UI.Gtk.Gdk.GLContext.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 'Graphics.UI.Gtk.Gdk.GLContext.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 'Graphics.UI.Gtk.Abstract.Widget.realize' signal; you can use the 'Graphics.UI.Gtk.Abstract.Widget.unrealize' signal -- to clean up. -- -- To receive mouse events on a drawing area, you will need to enable them -- with 'Graphics.UI.Gtk.Abstract.Widget.widgetAddEvents'. To receive keyboard events, you will need to set the -- 'Graphics.UI.Gtk.Abstract.Widget.widgetCanFocus' attribute on the drawing area. -- * Class Hierarchy -- | -- @ -- | 'GObject' -- | +----'Object' -- | +----'Widget' -- | +----GLArea -- @ -- * Types -- * Constructors -- * Methods {-# LINE 93 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -- * Attributes {-# LINE 102 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -- * Signals ) where import Control.Monad (liftM) import Control.Monad.Trans ( liftIO ) import System.Glib.FFI import System.Glib.UTFString import System.Glib.Attributes import System.Glib.Properties import System.Glib.GError import Graphics.UI.Gtk.Abstract.Object (makeNewObject) import Graphics.UI.Gtk.Gdk.GLContext import Graphics.UI.Gtk.Types {-# LINE 120 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} import Graphics.UI.Gtk.Signals {-# LINE 121 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} {-# LINE 123 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -------------------- -- Constructors {-# LINE 138 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -------------------- -- Methods {-# LINE 298 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -------------------- -- Attributes {-# LINE 363 "./Graphics/UI/Gtk/Misc/GLArea.chs" #-} -------------------- -- Signals