module Graphics.UI.Gtk.OpenGL.Config (
GLConfig,
GLConfigClass,
castToGLConfig,
toGLConfig,
GLConfigMode(..),
glConfigNew,
glConfigNewForScreen,
glConfigGetColormap,
glConfigGetLayerPlane,
glConfigGetNAuxBuffers,
glConfigGetNSampleBuffers,
glConfigIsRgba,
glConfigIsDoubleBuffered,
glConfigIsStereo,
glConfigHasAlpha,
glConfigHasDepthBuffer,
glConfigHasStencilBuffer,
glConfigHasAccumBuffer,
glConfigGetScreen,
glConfigGetDepth,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.Flags
import System.Glib.GObject (makeNewGObject, wrapNewGObject)
import Graphics.UI.Gtk.OpenGL.Types
data GLConfigMode =
GLModeRGB
| GLModeRGBA
| GLModeIndex
| GLModeSingle
| GLModeDouble
| GLModeStereo
| GLModeAlpha
| GLModeDepth
| GLModeStencil
| GLModeAccum
| GLModeMultiSample
deriving (Eq,Bounded)
instance Enum GLConfigMode where
fromEnum GLModeRGB = 0
fromEnum GLModeRGBA = 0
fromEnum GLModeIndex = 1
fromEnum GLModeSingle = 0
fromEnum GLModeDouble = 2
fromEnum GLModeStereo = 4
fromEnum GLModeAlpha = 8
fromEnum GLModeDepth = 16
fromEnum GLModeStencil = 32
fromEnum GLModeAccum = 64
fromEnum GLModeMultiSample = 128
toEnum 0 = GLModeRGB
toEnum 1 = GLModeIndex
toEnum 2 = GLModeDouble
toEnum 4 = GLModeStereo
toEnum 8 = GLModeAlpha
toEnum 16 = GLModeDepth
toEnum 32 = GLModeStencil
toEnum 64 = GLModeAccum
toEnum 128 = GLModeMultiSample
instance Flags GLConfigMode
glConfigNew ::
[GLConfigMode]
-> IO GLConfig
glConfigNew mode =
wrapNewGObject mkGLConfig $
gdk_gl_config_new_by_mode
((fromIntegral . fromFlags) mode)
glConfigNewForScreen ::
Screen
-> [GLConfigMode]
-> IO GLConfig
glConfigNewForScreen screen mode =
wrapNewGObject mkGLConfig $
(\(Screen arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_new_by_mode_for_screen argPtr1 arg2)
screen
((fromIntegral . fromFlags) mode)
glConfigGetScreen :: GLConfig
-> IO Screen
glConfigGetScreen self =
makeNewGObject mkScreen $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_get_screen argPtr1)
(toGLConfig self)
glConfigGetColormap :: GLConfig
-> IO Colormap
glConfigGetColormap self =
makeNewGObject mkColormap $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_get_colormap argPtr1)
(toGLConfig self)
glConfigGetDepth :: GLConfig
-> IO Int
glConfigGetDepth self =
liftM fromIntegral $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_get_depth argPtr1)
(toGLConfig self)
glConfigGetLayerPlane :: GLConfig
-> IO Int
glConfigGetLayerPlane self =
liftM fromIntegral $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_get_layer_plane argPtr1)
(toGLConfig self)
glConfigGetNAuxBuffers :: GLConfig
-> IO Int
glConfigGetNAuxBuffers self =
liftM fromIntegral $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_get_n_aux_buffers argPtr1)
(toGLConfig self)
glConfigGetNSampleBuffers :: GLConfig
-> IO Int
glConfigGetNSampleBuffers self =
liftM fromIntegral $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_get_n_sample_buffers argPtr1)
(toGLConfig self)
glConfigIsRgba :: GLConfig
-> IO Bool
glConfigIsRgba self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_is_rgba argPtr1)
(toGLConfig self)
glConfigIsDoubleBuffered :: GLConfig
-> IO Bool
glConfigIsDoubleBuffered self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_is_double_buffered argPtr1)
(toGLConfig self)
glConfigIsStereo :: GLConfig
-> IO Bool
glConfigIsStereo self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_is_stereo argPtr1)
(toGLConfig self)
glConfigHasAlpha :: GLConfig
-> IO Bool
glConfigHasAlpha self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_has_alpha argPtr1)
(toGLConfig self)
glConfigHasDepthBuffer :: GLConfig
-> IO Bool
glConfigHasDepthBuffer self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_has_depth_buffer argPtr1)
(toGLConfig self)
glConfigHasStencilBuffer :: GLConfig
-> IO Bool
glConfigHasStencilBuffer self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_has_stencil_buffer argPtr1)
(toGLConfig self)
glConfigHasAccumBuffer :: GLConfig
-> IO Bool
glConfigHasAccumBuffer self =
liftM toBool $
(\(GLConfig arg1) -> withForeignPtr arg1 $ \argPtr1 ->gdk_gl_config_has_accum_buffer argPtr1)
(toGLConfig self)
foreign import ccall safe "gdk_gl_config_new_by_mode"
gdk_gl_config_new_by_mode :: (CInt -> (IO (Ptr GLConfig)))
foreign import ccall safe "gdk_gl_config_new_by_mode_for_screen"
gdk_gl_config_new_by_mode_for_screen :: ((Ptr Screen) -> (CInt -> (IO (Ptr GLConfig))))
foreign import ccall safe "gdk_gl_config_get_screen"
gdk_gl_config_get_screen :: ((Ptr GLConfig) -> (IO (Ptr Screen)))
foreign import ccall safe "gdk_gl_config_get_colormap"
gdk_gl_config_get_colormap :: ((Ptr GLConfig) -> (IO (Ptr Colormap)))
foreign import ccall safe "gdk_gl_config_get_depth"
gdk_gl_config_get_depth :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_get_layer_plane"
gdk_gl_config_get_layer_plane :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_get_n_aux_buffers"
gdk_gl_config_get_n_aux_buffers :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_get_n_sample_buffers"
gdk_gl_config_get_n_sample_buffers :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_is_rgba"
gdk_gl_config_is_rgba :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_is_double_buffered"
gdk_gl_config_is_double_buffered :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_is_stereo"
gdk_gl_config_is_stereo :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_has_alpha"
gdk_gl_config_has_alpha :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_has_depth_buffer"
gdk_gl_config_has_depth_buffer :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_has_stencil_buffer"
gdk_gl_config_has_stencil_buffer :: ((Ptr GLConfig) -> (IO CInt))
foreign import ccall safe "gdk_gl_config_has_accum_buffer"
gdk_gl_config_has_accum_buffer :: ((Ptr GLConfig) -> (IO CInt))