{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) 'GI.Gdk.Objects.GLContext.GLContext' is an object representing the platform-specific OpenGL drawing context. @/GdkGLContexts/@ are created for a 'GI.Gdk.Objects.Window.Window' using 'GI.Gdk.Objects.Window.windowCreateGlContext', and the context will match the 'GI.Gdk.Objects.Visual.Visual' of the window. A 'GI.Gdk.Objects.GLContext.GLContext' is not tied to any particular normal framebuffer. For instance, it cannot draw to the 'GI.Gdk.Objects.Window.Window' back buffer. The GDK repaint system is in full control of the painting to that. Instead, you can create render buffers or textures and use 'GI.Gdk.Functions.cairoDrawFromGl' in the draw function of your widget to draw them. Then GDK will handle the integration of your rendering with that of other widgets. Support for 'GI.Gdk.Objects.GLContext.GLContext' is platform-specific, context creation can fail, returning 'Nothing' context. A 'GI.Gdk.Objects.GLContext.GLContext' has to be made \"current\" in order to start using it, otherwise any OpenGL call will be ignored. == Creating a new OpenGL context In order to create a new 'GI.Gdk.Objects.GLContext.GLContext' instance you need a 'GI.Gdk.Objects.Window.Window', which you typically get during the realize call of a widget. A 'GI.Gdk.Objects.GLContext.GLContext' is not realized until either 'GI.Gdk.Objects.GLContext.gLContextMakeCurrent', or until it is realized using 'GI.Gdk.Objects.GLContext.gLContextRealize'. It is possible to specify details of the GL context like the OpenGL version to be used, or whether the GL context should have extra state validation enabled after calling 'GI.Gdk.Objects.Window.windowCreateGlContext' by calling 'GI.Gdk.Objects.GLContext.gLContextRealize'. If the realization fails you have the option to change the settings of the 'GI.Gdk.Objects.GLContext.GLContext' and try again. == Using a GdkGLContext You will need to make the 'GI.Gdk.Objects.GLContext.GLContext' the current context before issuing OpenGL calls; the system sends OpenGL commands to whichever context is current. It is possible to have multiple contexts, so you always need to ensure that the one which you want to draw with is the current one before issuing commands: === /C code/ > > gdk_gl_context_make_current (context); You can now perform your drawing using OpenGL commands. You can check which 'GI.Gdk.Objects.GLContext.GLContext' is the current one by using 'GI.Gdk.Objects.GLContext.gLContextGetCurrent'; you can also unset any 'GI.Gdk.Objects.GLContext.GLContext' that is currently set by calling 'GI.Gdk.Objects.GLContext.gLContextClearCurrent'. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Gdk.Objects.GLContext ( -- * Exported types GLContext(..) , IsGLContext , toGLContext , noGLContext , -- * Methods -- ** clearCurrent #method:clearCurrent# gLContextClearCurrent , -- ** getCurrent #method:getCurrent# gLContextGetCurrent , -- ** getDebugEnabled #method:getDebugEnabled# #if ENABLE_OVERLOADING GLContextGetDebugEnabledMethodInfo , #endif gLContextGetDebugEnabled , -- ** getDisplay #method:getDisplay# #if ENABLE_OVERLOADING GLContextGetDisplayMethodInfo , #endif gLContextGetDisplay , -- ** getForwardCompatible #method:getForwardCompatible# #if ENABLE_OVERLOADING GLContextGetForwardCompatibleMethodInfo , #endif gLContextGetForwardCompatible , -- ** getRequiredVersion #method:getRequiredVersion# #if ENABLE_OVERLOADING GLContextGetRequiredVersionMethodInfo , #endif gLContextGetRequiredVersion , -- ** getSharedContext #method:getSharedContext# #if ENABLE_OVERLOADING GLContextGetSharedContextMethodInfo , #endif gLContextGetSharedContext , -- ** getUseEs #method:getUseEs# #if ENABLE_OVERLOADING GLContextGetUseEsMethodInfo , #endif gLContextGetUseEs , -- ** getVersion #method:getVersion# #if ENABLE_OVERLOADING GLContextGetVersionMethodInfo , #endif gLContextGetVersion , -- ** getWindow #method:getWindow# #if ENABLE_OVERLOADING GLContextGetWindowMethodInfo , #endif gLContextGetWindow , -- ** isLegacy #method:isLegacy# #if ENABLE_OVERLOADING GLContextIsLegacyMethodInfo , #endif gLContextIsLegacy , -- ** makeCurrent #method:makeCurrent# #if ENABLE_OVERLOADING GLContextMakeCurrentMethodInfo , #endif gLContextMakeCurrent , -- ** realize #method:realize# #if ENABLE_OVERLOADING GLContextRealizeMethodInfo , #endif gLContextRealize , -- ** setDebugEnabled #method:setDebugEnabled# #if ENABLE_OVERLOADING GLContextSetDebugEnabledMethodInfo , #endif gLContextSetDebugEnabled , -- ** setForwardCompatible #method:setForwardCompatible# #if ENABLE_OVERLOADING GLContextSetForwardCompatibleMethodInfo , #endif gLContextSetForwardCompatible , -- ** setRequiredVersion #method:setRequiredVersion# #if ENABLE_OVERLOADING GLContextSetRequiredVersionMethodInfo , #endif gLContextSetRequiredVersion , -- ** setUseEs #method:setUseEs# #if ENABLE_OVERLOADING GLContextSetUseEsMethodInfo , #endif gLContextSetUseEs , -- * Properties -- ** display #attr:display# {- | The 'GI.Gdk.Objects.Display.Display' used to create the 'GI.Gdk.Objects.GLContext.GLContext'. /Since: 3.16/ -} #if ENABLE_OVERLOADING GLContextDisplayPropertyInfo , #endif constructGLContextDisplay , #if ENABLE_OVERLOADING gLContextDisplay , #endif getGLContextDisplay , -- ** sharedContext #attr:sharedContext# {- | The 'GI.Gdk.Objects.GLContext.GLContext' that this context is sharing data with, or 'Nothing' /Since: 3.16/ -} #if ENABLE_OVERLOADING GLContextSharedContextPropertyInfo , #endif constructGLContextSharedContext , #if ENABLE_OVERLOADING gLContextSharedContext , #endif getGLContextSharedContext , -- ** window #attr:window# {- | The 'GI.Gdk.Objects.Window.Window' the gl context is bound to. /Since: 3.16/ -} #if ENABLE_OVERLOADING GLContextWindowPropertyInfo , #endif constructGLContextWindow , #if ENABLE_OVERLOADING gLContextWindow , #endif getGLContextWindow , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GI.GObject.Objects.Object as GObject.Object import {-# SOURCE #-} qualified GI.Gdk.Objects.Display as Gdk.Display import {-# SOURCE #-} qualified GI.Gdk.Objects.Window as Gdk.Window -- | Memory-managed wrapper type. newtype GLContext = GLContext (ManagedPtr GLContext) foreign import ccall "gdk_gl_context_get_type" c_gdk_gl_context_get_type :: IO GType instance GObject GLContext where gobjectType = c_gdk_gl_context_get_type -- | Type class for types which can be safely cast to `GLContext`, for instance with `toGLContext`. class (GObject o, O.IsDescendantOf GLContext o) => IsGLContext o instance (GObject o, O.IsDescendantOf GLContext o) => IsGLContext o instance O.HasParentTypes GLContext type instance O.ParentTypes GLContext = '[GObject.Object.Object] -- | Cast to `GLContext`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toGLContext :: (MonadIO m, IsGLContext o) => o -> m GLContext toGLContext = liftIO . unsafeCastTo GLContext -- | A convenience alias for `Nothing` :: `Maybe` `GLContext`. noGLContext :: Maybe GLContext noGLContext = Nothing #if ENABLE_OVERLOADING type family ResolveGLContextMethod (t :: Symbol) (o :: *) :: * where ResolveGLContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveGLContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveGLContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveGLContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveGLContextMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveGLContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveGLContextMethod "isLegacy" o = GLContextIsLegacyMethodInfo ResolveGLContextMethod "makeCurrent" o = GLContextMakeCurrentMethodInfo ResolveGLContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveGLContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveGLContextMethod "realize" o = GLContextRealizeMethodInfo ResolveGLContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveGLContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveGLContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveGLContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveGLContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveGLContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveGLContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveGLContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveGLContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveGLContextMethod "getDebugEnabled" o = GLContextGetDebugEnabledMethodInfo ResolveGLContextMethod "getDisplay" o = GLContextGetDisplayMethodInfo ResolveGLContextMethod "getForwardCompatible" o = GLContextGetForwardCompatibleMethodInfo ResolveGLContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveGLContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveGLContextMethod "getRequiredVersion" o = GLContextGetRequiredVersionMethodInfo ResolveGLContextMethod "getSharedContext" o = GLContextGetSharedContextMethodInfo ResolveGLContextMethod "getUseEs" o = GLContextGetUseEsMethodInfo ResolveGLContextMethod "getVersion" o = GLContextGetVersionMethodInfo ResolveGLContextMethod "getWindow" o = GLContextGetWindowMethodInfo ResolveGLContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveGLContextMethod "setDebugEnabled" o = GLContextSetDebugEnabledMethodInfo ResolveGLContextMethod "setForwardCompatible" o = GLContextSetForwardCompatibleMethodInfo ResolveGLContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveGLContextMethod "setRequiredVersion" o = GLContextSetRequiredVersionMethodInfo ResolveGLContextMethod "setUseEs" o = GLContextSetUseEsMethodInfo ResolveGLContextMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveGLContextMethod t GLContext, O.MethodInfo info GLContext p) => OL.IsLabel t (GLContext -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #else fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info) #endif #endif -- VVV Prop "display" -- Type: TInterface (Name {namespace = "Gdk", name = "Display"}) -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just True,Nothing) {- | Get the value of the “@display@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' gLContext #display @ -} getGLContextDisplay :: (MonadIO m, IsGLContext o) => o -> m (Maybe Gdk.Display.Display) getGLContextDisplay obj = liftIO $ B.Properties.getObjectPropertyObject obj "display" Gdk.Display.Display {- | Construct a `GValueConstruct` with valid value for the “@display@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructGLContextDisplay :: (IsGLContext o, Gdk.Display.IsDisplay a) => a -> IO (GValueConstruct o) constructGLContextDisplay val = B.Properties.constructObjectPropertyObject "display" (Just val) #if ENABLE_OVERLOADING data GLContextDisplayPropertyInfo instance AttrInfo GLContextDisplayPropertyInfo where type AttrAllowedOps GLContextDisplayPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint GLContextDisplayPropertyInfo = Gdk.Display.IsDisplay type AttrBaseTypeConstraint GLContextDisplayPropertyInfo = IsGLContext type AttrGetType GLContextDisplayPropertyInfo = (Maybe Gdk.Display.Display) type AttrLabel GLContextDisplayPropertyInfo = "display" type AttrOrigin GLContextDisplayPropertyInfo = GLContext attrGet _ = getGLContextDisplay attrSet _ = undefined attrConstruct _ = constructGLContextDisplay attrClear _ = undefined #endif -- VVV Prop "shared-context" -- Type: TInterface (Name {namespace = "Gdk", name = "GLContext"}) -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just True,Nothing) {- | Get the value of the “@shared-context@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' gLContext #sharedContext @ -} getGLContextSharedContext :: (MonadIO m, IsGLContext o) => o -> m (Maybe GLContext) getGLContextSharedContext obj = liftIO $ B.Properties.getObjectPropertyObject obj "shared-context" GLContext {- | Construct a `GValueConstruct` with valid value for the “@shared-context@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructGLContextSharedContext :: (IsGLContext o, IsGLContext a) => a -> IO (GValueConstruct o) constructGLContextSharedContext val = B.Properties.constructObjectPropertyObject "shared-context" (Just val) #if ENABLE_OVERLOADING data GLContextSharedContextPropertyInfo instance AttrInfo GLContextSharedContextPropertyInfo where type AttrAllowedOps GLContextSharedContextPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint GLContextSharedContextPropertyInfo = IsGLContext type AttrBaseTypeConstraint GLContextSharedContextPropertyInfo = IsGLContext type AttrGetType GLContextSharedContextPropertyInfo = (Maybe GLContext) type AttrLabel GLContextSharedContextPropertyInfo = "shared-context" type AttrOrigin GLContextSharedContextPropertyInfo = GLContext attrGet _ = getGLContextSharedContext attrSet _ = undefined attrConstruct _ = constructGLContextSharedContext attrClear _ = undefined #endif -- VVV Prop "window" -- Type: TInterface (Name {namespace = "Gdk", name = "Window"}) -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just True,Nothing) {- | Get the value of the “@window@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' gLContext #window @ -} getGLContextWindow :: (MonadIO m, IsGLContext o) => o -> m (Maybe Gdk.Window.Window) getGLContextWindow obj = liftIO $ B.Properties.getObjectPropertyObject obj "window" Gdk.Window.Window {- | Construct a `GValueConstruct` with valid value for the “@window@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructGLContextWindow :: (IsGLContext o, Gdk.Window.IsWindow a) => a -> IO (GValueConstruct o) constructGLContextWindow val = B.Properties.constructObjectPropertyObject "window" (Just val) #if ENABLE_OVERLOADING data GLContextWindowPropertyInfo instance AttrInfo GLContextWindowPropertyInfo where type AttrAllowedOps GLContextWindowPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear] type AttrSetTypeConstraint GLContextWindowPropertyInfo = Gdk.Window.IsWindow type AttrBaseTypeConstraint GLContextWindowPropertyInfo = IsGLContext type AttrGetType GLContextWindowPropertyInfo = (Maybe Gdk.Window.Window) type AttrLabel GLContextWindowPropertyInfo = "window" type AttrOrigin GLContextWindowPropertyInfo = GLContext attrGet _ = getGLContextWindow attrSet _ = undefined attrConstruct _ = constructGLContextWindow attrClear _ = undefined #endif #if ENABLE_OVERLOADING instance O.HasAttributeList GLContext type instance O.AttributeList GLContext = GLContextAttributeList type GLContextAttributeList = ('[ '("display", GLContextDisplayPropertyInfo), '("sharedContext", GLContextSharedContextPropertyInfo), '("window", GLContextWindowPropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING gLContextDisplay :: AttrLabelProxy "display" gLContextDisplay = AttrLabelProxy gLContextSharedContext :: AttrLabelProxy "sharedContext" gLContextSharedContext = AttrLabelProxy gLContextWindow :: AttrLabelProxy "window" gLContextWindow = AttrLabelProxy #endif #if ENABLE_OVERLOADING type instance O.SignalList GLContext = GLContextSignalList type GLContextSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method GLContext::get_debug_enabled -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_debug_enabled" gdk_gl_context_get_debug_enabled :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO CInt {- | Retrieves the value set using 'GI.Gdk.Objects.GLContext.gLContextSetDebugEnabled'. /Since: 3.16/ -} gLContextGetDebugEnabled :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m Bool {- ^ __Returns:__ 'True' if debugging is enabled -} gLContextGetDebugEnabled context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_get_debug_enabled context' let result' = (/= 0) result touchManagedPtr context return result' #if ENABLE_OVERLOADING data GLContextGetDebugEnabledMethodInfo instance (signature ~ (m Bool), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetDebugEnabledMethodInfo a signature where overloadedMethod _ = gLContextGetDebugEnabled #endif -- method GLContext::get_display -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gdk", name = "Display"})) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_display" gdk_gl_context_get_display :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO (Ptr Gdk.Display.Display) {- | Retrieves the 'GI.Gdk.Objects.Display.Display' the /@context@/ is created for /Since: 3.16/ -} gLContextGetDisplay :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m (Maybe Gdk.Display.Display) {- ^ __Returns:__ a 'GI.Gdk.Objects.Display.Display' or 'Nothing' -} gLContextGetDisplay context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_get_display context' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject Gdk.Display.Display) result' return result'' touchManagedPtr context return maybeResult #if ENABLE_OVERLOADING data GLContextGetDisplayMethodInfo instance (signature ~ (m (Maybe Gdk.Display.Display)), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetDisplayMethodInfo a signature where overloadedMethod _ = gLContextGetDisplay #endif -- method GLContext::get_forward_compatible -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_forward_compatible" gdk_gl_context_get_forward_compatible :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO CInt {- | Retrieves the value set using 'GI.Gdk.Objects.GLContext.gLContextSetForwardCompatible'. /Since: 3.16/ -} gLContextGetForwardCompatible :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m Bool {- ^ __Returns:__ 'True' if the context should be forward compatible -} gLContextGetForwardCompatible context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_get_forward_compatible context' let result' = (/= 0) result touchManagedPtr context return result' #if ENABLE_OVERLOADING data GLContextGetForwardCompatibleMethodInfo instance (signature ~ (m Bool), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetForwardCompatibleMethodInfo a signature where overloadedMethod _ = gLContextGetForwardCompatible #endif -- method GLContext::get_required_version -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "major", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "return location for the major version to request", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "minor", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = True, argDoc = Documentation {rawDocText = Just "return location for the minor version to request", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_required_version" gdk_gl_context_get_required_version :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) Ptr Int32 -> -- major : TBasicType TInt Ptr Int32 -> -- minor : TBasicType TInt IO () {- | Retrieves the major and minor version requested by calling 'GI.Gdk.Objects.GLContext.gLContextSetRequiredVersion'. /Since: 3.16/ -} gLContextGetRequiredVersion :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m ((Int32, Int32)) gLContextGetRequiredVersion context = liftIO $ do context' <- unsafeManagedPtrCastPtr context major <- allocMem :: IO (Ptr Int32) minor <- allocMem :: IO (Ptr Int32) gdk_gl_context_get_required_version context' major minor major' <- peek major minor' <- peek minor touchManagedPtr context freeMem major freeMem minor return (major', minor') #if ENABLE_OVERLOADING data GLContextGetRequiredVersionMethodInfo instance (signature ~ (m ((Int32, Int32))), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetRequiredVersionMethodInfo a signature where overloadedMethod _ = gLContextGetRequiredVersion #endif -- method GLContext::get_shared_context -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gdk", name = "GLContext"})) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_shared_context" gdk_gl_context_get_shared_context :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO (Ptr GLContext) {- | Retrieves the 'GI.Gdk.Objects.GLContext.GLContext' that this /@context@/ share data with. /Since: 3.16/ -} gLContextGetSharedContext :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m (Maybe GLContext) {- ^ __Returns:__ a 'GI.Gdk.Objects.GLContext.GLContext' or 'Nothing' -} gLContextGetSharedContext context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_get_shared_context context' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject GLContext) result' return result'' touchManagedPtr context return maybeResult #if ENABLE_OVERLOADING data GLContextGetSharedContextMethodInfo instance (signature ~ (m (Maybe GLContext)), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetSharedContextMethodInfo a signature where overloadedMethod _ = gLContextGetSharedContext #endif -- method GLContext::get_use_es -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_use_es" gdk_gl_context_get_use_es :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO CInt {- | Checks whether the /@context@/ is using an OpenGL or OpenGL ES profile. /Since: 3.22/ -} gLContextGetUseEs :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m Bool {- ^ __Returns:__ 'True' if the 'GI.Gdk.Objects.GLContext.GLContext' is using an OpenGL ES profile -} gLContextGetUseEs context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_get_use_es context' let result' = (/= 0) result touchManagedPtr context return result' #if ENABLE_OVERLOADING data GLContextGetUseEsMethodInfo instance (signature ~ (m Bool), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetUseEsMethodInfo a signature where overloadedMethod _ = gLContextGetUseEs #endif -- method GLContext::get_version -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "major", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the major version", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "minor", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the minor version", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_version" gdk_gl_context_get_version :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) Ptr Int32 -> -- major : TBasicType TInt Ptr Int32 -> -- minor : TBasicType TInt IO () {- | Retrieves the OpenGL version of the /@context@/. The /@context@/ must be realized prior to calling this function. /Since: 3.16/ -} gLContextGetVersion :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m ((Int32, Int32)) gLContextGetVersion context = liftIO $ do context' <- unsafeManagedPtrCastPtr context major <- allocMem :: IO (Ptr Int32) minor <- allocMem :: IO (Ptr Int32) gdk_gl_context_get_version context' major minor major' <- peek major minor' <- peek minor touchManagedPtr context freeMem major freeMem minor return (major', minor') #if ENABLE_OVERLOADING data GLContextGetVersionMethodInfo instance (signature ~ (m ((Int32, Int32))), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetVersionMethodInfo a signature where overloadedMethod _ = gLContextGetVersion #endif -- method GLContext::get_window -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gdk", name = "Window"})) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_window" gdk_gl_context_get_window :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO (Ptr Gdk.Window.Window) {- | Retrieves the 'GI.Gdk.Objects.Window.Window' used by the /@context@/. /Since: 3.16/ -} gLContextGetWindow :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m (Maybe Gdk.Window.Window) {- ^ __Returns:__ a 'GI.Gdk.Objects.Window.Window' or 'Nothing' -} gLContextGetWindow context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_get_window context' maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject Gdk.Window.Window) result' return result'' touchManagedPtr context return maybeResult #if ENABLE_OVERLOADING data GLContextGetWindowMethodInfo instance (signature ~ (m (Maybe Gdk.Window.Window)), MonadIO m, IsGLContext a) => O.MethodInfo GLContextGetWindowMethodInfo a signature where overloadedMethod _ = gLContextGetWindow #endif -- method GLContext::is_legacy -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_is_legacy" gdk_gl_context_is_legacy :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO CInt {- | Whether the 'GI.Gdk.Objects.GLContext.GLContext' is in legacy mode or not. The 'GI.Gdk.Objects.GLContext.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. /Since: 3.20/ -} gLContextIsLegacy :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m Bool {- ^ __Returns:__ 'True' if the GL context is in legacy mode -} gLContextIsLegacy context = liftIO $ do context' <- unsafeManagedPtrCastPtr context result <- gdk_gl_context_is_legacy context' let result' = (/= 0) result touchManagedPtr context return result' #if ENABLE_OVERLOADING data GLContextIsLegacyMethodInfo instance (signature ~ (m Bool), MonadIO m, IsGLContext a) => O.MethodInfo GLContextIsLegacyMethodInfo a signature where overloadedMethod _ = gLContextIsLegacy #endif -- method GLContext::make_current -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_make_current" gdk_gl_context_make_current :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) IO () {- | Makes the /@context@/ the current one. /Since: 3.16/ -} gLContextMakeCurrent :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m () gLContextMakeCurrent context = liftIO $ do context' <- unsafeManagedPtrCastPtr context gdk_gl_context_make_current context' touchManagedPtr context return () #if ENABLE_OVERLOADING data GLContextMakeCurrentMethodInfo instance (signature ~ (m ()), MonadIO m, IsGLContext a) => O.MethodInfo GLContextMakeCurrentMethodInfo a signature where overloadedMethod _ = gLContextMakeCurrent #endif -- method GLContext::realize -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TBoolean) -- throws : True -- Skip return : False foreign import ccall "gdk_gl_context_realize" gdk_gl_context_realize :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) Ptr (Ptr GError) -> -- error IO CInt {- | Realizes the given 'GI.Gdk.Objects.GLContext.GLContext'. It is safe to call this function on a realized 'GI.Gdk.Objects.GLContext.GLContext'. /Since: 3.16/ -} gLContextRealize :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> m () {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -} gLContextRealize context = liftIO $ do context' <- unsafeManagedPtrCastPtr context onException (do _ <- propagateGError $ gdk_gl_context_realize context' touchManagedPtr context return () ) (do return () ) #if ENABLE_OVERLOADING data GLContextRealizeMethodInfo instance (signature ~ (m ()), MonadIO m, IsGLContext a) => O.MethodInfo GLContextRealizeMethodInfo a signature where overloadedMethod _ = gLContextRealize #endif -- method GLContext::set_debug_enabled -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enabled", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether to enable debugging in the context", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_set_debug_enabled" gdk_gl_context_set_debug_enabled :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) CInt -> -- enabled : TBasicType TBoolean IO () {- | Sets whether the 'GI.Gdk.Objects.GLContext.GLContext' should perform extra validations and run time checking. This is useful during development, but has additional overhead. The 'GI.Gdk.Objects.GLContext.GLContext' must not be realized or made current prior to calling this function. /Since: 3.16/ -} gLContextSetDebugEnabled :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> Bool {- ^ /@enabled@/: whether to enable debugging in the context -} -> m () gLContextSetDebugEnabled context enabled = liftIO $ do context' <- unsafeManagedPtrCastPtr context let enabled' = (fromIntegral . fromEnum) enabled gdk_gl_context_set_debug_enabled context' enabled' touchManagedPtr context return () #if ENABLE_OVERLOADING data GLContextSetDebugEnabledMethodInfo instance (signature ~ (Bool -> m ()), MonadIO m, IsGLContext a) => O.MethodInfo GLContextSetDebugEnabledMethodInfo a signature where overloadedMethod _ = gLContextSetDebugEnabled #endif -- method GLContext::set_forward_compatible -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "compatible", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether the context should be forward compatible", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_set_forward_compatible" gdk_gl_context_set_forward_compatible :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) CInt -> -- compatible : TBasicType TBoolean IO () {- | Sets whether the 'GI.Gdk.Objects.GLContext.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 'GI.Gdk.Objects.GLContext.GLContext' must not be realized or made current prior to calling this function. /Since: 3.16/ -} gLContextSetForwardCompatible :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> Bool {- ^ /@compatible@/: whether the context should be forward compatible -} -> m () gLContextSetForwardCompatible context compatible = liftIO $ do context' <- unsafeManagedPtrCastPtr context let compatible' = (fromIntegral . fromEnum) compatible gdk_gl_context_set_forward_compatible context' compatible' touchManagedPtr context return () #if ENABLE_OVERLOADING data GLContextSetForwardCompatibleMethodInfo instance (signature ~ (Bool -> m ()), MonadIO m, IsGLContext a) => O.MethodInfo GLContextSetForwardCompatibleMethodInfo a signature where overloadedMethod _ = gLContextSetForwardCompatible #endif -- method GLContext::set_required_version -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "major", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the major version to request", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minor", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the minor version to request", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_set_required_version" gdk_gl_context_set_required_version :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) Int32 -> -- major : TBasicType TInt Int32 -> -- minor : TBasicType TInt IO () {- | Sets the major and minor version of OpenGL to request. Setting /@major@/ and /@minor@/ to zero will use the default values. The 'GI.Gdk.Objects.GLContext.GLContext' must not be realized or made current prior to calling this function. /Since: 3.16/ -} gLContextSetRequiredVersion :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext' -} -> Int32 {- ^ /@major@/: the major version to request -} -> Int32 {- ^ /@minor@/: the minor version to request -} -> m () gLContextSetRequiredVersion context major minor = liftIO $ do context' <- unsafeManagedPtrCastPtr context gdk_gl_context_set_required_version context' major minor touchManagedPtr context return () #if ENABLE_OVERLOADING data GLContextSetRequiredVersionMethodInfo instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m, IsGLContext a) => O.MethodInfo GLContextSetRequiredVersionMethodInfo a signature where overloadedMethod _ = gLContextSetRequiredVersion #endif -- method GLContext::set_use_es -- method type : OrdinaryMethod -- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gdk", name = "GLContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkGLContext:", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "use_es", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether the context should use OpenGL ES instead of OpenGL,\n or -1 to allow auto-detection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_set_use_es" gdk_gl_context_set_use_es :: Ptr GLContext -> -- context : TInterface (Name {namespace = "Gdk", name = "GLContext"}) Int32 -> -- use_es : TBasicType TInt IO () {- | Requests that GDK create a OpenGL ES context instead of an OpenGL one, if the platform and windowing system allows it. The /@context@/ must not have been realized. By default, GDK will attempt to automatically detect whether the underlying GL implementation is OpenGL or OpenGL ES once the /@context@/ is realized. You should check the return value of 'GI.Gdk.Objects.GLContext.gLContextGetUseEs' after calling 'GI.Gdk.Objects.GLContext.gLContextRealize' to decide whether to use the OpenGL or OpenGL ES API, extensions, or shaders. /Since: 3.22/ -} gLContextSetUseEs :: (B.CallStack.HasCallStack, MonadIO m, IsGLContext a) => a {- ^ /@context@/: a 'GI.Gdk.Objects.GLContext.GLContext': -} -> Int32 {- ^ /@useEs@/: whether the context should use OpenGL ES instead of OpenGL, or -1 to allow auto-detection -} -> m () gLContextSetUseEs context useEs = liftIO $ do context' <- unsafeManagedPtrCastPtr context gdk_gl_context_set_use_es context' useEs touchManagedPtr context return () #if ENABLE_OVERLOADING data GLContextSetUseEsMethodInfo instance (signature ~ (Int32 -> m ()), MonadIO m, IsGLContext a) => O.MethodInfo GLContextSetUseEsMethodInfo a signature where overloadedMethod _ = gLContextSetUseEs #endif -- method GLContext::clear_current -- method type : MemberFunction -- Args : [] -- Lengths : [] -- returnType : Nothing -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_clear_current" gdk_gl_context_clear_current :: IO () {- | Clears the current 'GI.Gdk.Objects.GLContext.GLContext'. Any OpenGL call after this function returns will be ignored until 'GI.Gdk.Objects.GLContext.gLContextMakeCurrent' is called. /Since: 3.16/ -} gLContextClearCurrent :: (B.CallStack.HasCallStack, MonadIO m) => m () gLContextClearCurrent = liftIO $ do gdk_gl_context_clear_current return () #if ENABLE_OVERLOADING #endif -- method GLContext::get_current -- method type : MemberFunction -- Args : [] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gdk", name = "GLContext"})) -- throws : False -- Skip return : False foreign import ccall "gdk_gl_context_get_current" gdk_gl_context_get_current :: IO (Ptr GLContext) {- | Retrieves the current 'GI.Gdk.Objects.GLContext.GLContext'. /Since: 3.16/ -} gLContextGetCurrent :: (B.CallStack.HasCallStack, MonadIO m) => m (Maybe GLContext) {- ^ __Returns:__ the current 'GI.Gdk.Objects.GLContext.GLContext', or 'Nothing' -} gLContextGetCurrent = liftIO $ do result <- gdk_gl_context_get_current maybeResult <- convertIfNonNull result $ \result' -> do result'' <- (newObject GLContext) result' return result'' return maybeResult #if ENABLE_OVERLOADING #endif