{-# LINE 2 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
module Graphics.UI.Gtk.Gdk.GLContext (
GLContext,
GLContextClass,
castToGLContext, gTypeGLContext,
glContextGetDisplay,
glContextGetWindow,
glContextGetSharedContext,
glContextGetVersion,
glContextSetRequiredVersion,
glContextGetRequiredVersion,
glContextSetDebugEnabled,
glContextGetDebugEnabled,
glContextSetForwardCompatible,
glContextGetForwardCompatible,
glContextRealize,
glContextIsLegacy,
glContextMakeCurrent,
glContextGetCurrent,
glContextClearCurrent
) where
import Control.Monad (liftM)
import Data.Maybe (fromMaybe)
import System.Glib.FFI
import System.Glib.Flags (toFlags)
import Graphics.UI.Gtk.Types
{-# LINE 89 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
import Graphics.UI.Gtk.Gdk.Enums
{-# LINE 90 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
import Graphics.UI.Gtk.Gdk.Cursor
{-# LINE 91 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
import Graphics.UI.Gtk.General.Structs
import System.Glib.GError (propagateGError)
import System.Glib.Attributes
{-# LINE 96 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
glContextGetDisplay :: GLContextClass self => self -> IO (Maybe Display)
glContextGetDisplay self = do
maybeNull (wrapNewGObject mkDisplay) $
(\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_display argPtr1) (toGLContext self)
glContextGetWindow :: GLContextClass self => self -> IO (Maybe DrawWindow)
glContextGetWindow self = do
maybeNull (wrapNewGObject mkDrawWindow) $
(\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_window argPtr1) (toGLContext self)
glContextGetSharedContext :: GLContextClass self => self -> IO (Maybe GLContext)
glContextGetSharedContext self = do
maybeNull (wrapNewGObject mkGLContext) $
(\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_shared_context argPtr1) (toGLContext self)
glContextGetVersion :: GLContextClass self => self -> IO (Int, Int)
glContextGetVersion self = do
alloca $ \majorPtr -> alloca $ \minorPtr -> do
(\(GLContext arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_version argPtr1 arg2 arg3) (toGLContext self) majorPtr minorPtr
major <- peek majorPtr
minor <- peek minorPtr
return (fromIntegral major, fromIntegral minor)
glContextSetRequiredVersion :: GLContextClass self => self -> Int -> Int -> IO ()
glContextSetRequiredVersion self major minor =
(\(GLContext arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_set_required_version argPtr1 arg2 arg3)
{-# LINE 148 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
(toGLContext self) (fromIntegral major) (fromIntegral minor)
glContextGetRequiredVersion :: GLContextClass self => self -> IO (Int, Int)
glContextGetRequiredVersion self = do
alloca $ \majorPtr -> alloca $ \minorPtr -> do
(\(GLContext arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_required_version argPtr1 arg2 arg3) (toGLContext self) majorPtr minorPtr
major <- peek majorPtr
minor <- peek minorPtr
return (fromIntegral major, fromIntegral minor)
glContextSetDebugEnabled :: GLContextClass self => self -> Bool -> IO ()
glContextSetDebugEnabled self enabled = do
(\(GLContext arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_set_debug_enabled argPtr1 arg2) (toGLContext self) (fromBool enabled)
glContextGetDebugEnabled :: GLContextClass self => self -> IO Bool
glContextGetDebugEnabled self = do
liftM toBool $ (\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_debug_enabled argPtr1) (toGLContext self)
glContextSetForwardCompatible :: GLContextClass self => self -> Bool -> IO ()
glContextSetForwardCompatible self compatible = do
(\(GLContext arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_set_forward_compatible argPtr1 arg2) (toGLContext self) (fromBool compatible)
glContextGetForwardCompatible :: GLContextClass self => self -> IO Bool
glContextGetForwardCompatible self = do
liftM toBool $ (\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_get_forward_compatible argPtr1) (toGLContext self)
glContextIsLegacy :: GLContextClass self => self -> IO Bool
glContextIsLegacy self = do
liftM toBool $ (\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_is_legacy argPtr1) (toGLContext self)
glContextRealize :: GLContextClass self => self -> IO Bool
glContextRealize self =
liftM toBool $
propagateGError $ \errPtr ->
(\(GLContext arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_realize argPtr1 arg2) (toGLContext self) errPtr
glContextMakeCurrent :: GLContextClass self => self -> IO ()
glContextMakeCurrent self = do
(\(GLContext arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_context_make_current argPtr1) (toGLContext self)
glContextGetCurrent :: IO (Maybe GLContext)
glContextGetCurrent = do
maybeNull (wrapNewGObject mkGLContext) $
gdk_gl_context_get_current
{-# LINE 246 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
glContextClearCurrent :: IO ()
glContextClearCurrent = do
gdk_gl_context_clear_current
{-# LINE 256 "./Graphics/UI/Gtk/Gdk/GLContext.chs" #-}
foreign import ccall safe "gdk_gl_context_get_display"
gdk_gl_context_get_display :: ((Ptr GLContext) -> (IO (Ptr Display)))
foreign import ccall safe "gdk_gl_context_get_window"
gdk_gl_context_get_window :: ((Ptr GLContext) -> (IO (Ptr DrawWindow)))
foreign import ccall safe "gdk_gl_context_get_shared_context"
gdk_gl_context_get_shared_context :: ((Ptr GLContext) -> (IO (Ptr GLContext)))
foreign import ccall safe "gdk_gl_context_get_version"
gdk_gl_context_get_version :: ((Ptr GLContext) -> ((Ptr CInt) -> ((Ptr CInt) -> (IO ()))))
foreign import ccall safe "gdk_gl_context_set_required_version"
gdk_gl_context_set_required_version :: ((Ptr GLContext) -> (CInt -> (CInt -> (IO ()))))
foreign import ccall safe "gdk_gl_context_get_required_version"
gdk_gl_context_get_required_version :: ((Ptr GLContext) -> ((Ptr CInt) -> ((Ptr CInt) -> (IO ()))))
foreign import ccall safe "gdk_gl_context_set_debug_enabled"
gdk_gl_context_set_debug_enabled :: ((Ptr GLContext) -> (CInt -> (IO ())))
foreign import ccall safe "gdk_gl_context_get_debug_enabled"
gdk_gl_context_get_debug_enabled :: ((Ptr GLContext) -> (IO CInt))
foreign import ccall safe "gdk_gl_context_set_forward_compatible"
gdk_gl_context_set_forward_compatible :: ((Ptr GLContext) -> (CInt -> (IO ())))
foreign import ccall safe "gdk_gl_context_get_forward_compatible"
gdk_gl_context_get_forward_compatible :: ((Ptr GLContext) -> (IO CInt))
foreign import ccall safe "gdk_gl_context_is_legacy"
gdk_gl_context_is_legacy :: ((Ptr GLContext) -> (IO CInt))
foreign import ccall safe "gdk_gl_context_realize"
gdk_gl_context_realize :: ((Ptr GLContext) -> ((Ptr (Ptr ())) -> (IO CInt)))
foreign import ccall safe "gdk_gl_context_make_current"
gdk_gl_context_make_current :: ((Ptr GLContext) -> (IO ()))
foreign import ccall safe "gdk_gl_context_get_current"
gdk_gl_context_get_current :: (IO (Ptr GLContext))
foreign import ccall safe "gdk_gl_context_clear_current"
gdk_gl_context_clear_current :: (IO ())