    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget
    -- Copyright   :  (c) Sven Panne 2019
    -- License     :  BSD3
    --
    -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
    -- Stability   :  stable
    -- Portability :  portable
    --
    -- This is a purely internal module for handling RenderbufferTargets.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget (
       RenderbufferTarget(..), marshalRenderbufferTarget, getRBParameteriv,
       Samples(..)
    ) where

    import Foreign.Marshal
    import Graphics.Rendering.OpenGL.GL.PeekPoke
    import Graphics.GL

    --------------------------------------------------------------------------------

    data RenderbufferTarget = Renderbuffer
       deriving ( RenderbufferTarget -> RenderbufferTarget -> Bool
    (RenderbufferTarget -> RenderbufferTarget -> Bool)
    -> (RenderbufferTarget -> RenderbufferTarget -> Bool)
    -> Eq RenderbufferTarget
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: RenderbufferTarget -> RenderbufferTarget -> Bool
    == :: RenderbufferTarget -> RenderbufferTarget -> Bool
    $c/= :: RenderbufferTarget -> RenderbufferTarget -> Bool
    /= :: RenderbufferTarget -> RenderbufferTarget -> Bool
    Eq, Eq RenderbufferTarget
    Eq RenderbufferTarget =>
    (RenderbufferTarget -> RenderbufferTarget -> Ordering)
    -> (RenderbufferTarget -> RenderbufferTarget -> Bool)
    -> (RenderbufferTarget -> RenderbufferTarget -> Bool)
    -> (RenderbufferTarget -> RenderbufferTarget -> Bool)
    -> (RenderbufferTarget -> RenderbufferTarget -> Bool)
    -> (RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget)
    -> (RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget)
    -> Ord RenderbufferTarget
    RenderbufferTarget -> RenderbufferTarget -> Bool
    RenderbufferTarget -> RenderbufferTarget -> Ordering
    RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: RenderbufferTarget -> RenderbufferTarget -> Ordering
    compare :: RenderbufferTarget -> RenderbufferTarget -> Ordering
    $c< :: RenderbufferTarget -> RenderbufferTarget -> Bool
    < :: RenderbufferTarget -> RenderbufferTarget -> Bool
    $c<= :: RenderbufferTarget -> RenderbufferTarget -> Bool
    <= :: RenderbufferTarget -> RenderbufferTarget -> Bool
    $c> :: RenderbufferTarget -> RenderbufferTarget -> Bool
    > :: RenderbufferTarget -> RenderbufferTarget -> Bool
    $c>= :: RenderbufferTarget -> RenderbufferTarget -> Bool
    >= :: RenderbufferTarget -> RenderbufferTarget -> Bool
    $cmax :: RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget
    max :: RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget
    $cmin :: RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget
    min :: RenderbufferTarget -> RenderbufferTarget -> RenderbufferTarget
    Ord, Int -> RenderbufferTarget -> ShowS
    [RenderbufferTarget] -> ShowS
    RenderbufferTarget -> String
    (Int -> RenderbufferTarget -> ShowS)
    -> (RenderbufferTarget -> String)
    -> ([RenderbufferTarget] -> ShowS)
    -> Show RenderbufferTarget
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> RenderbufferTarget -> ShowS
    showsPrec :: Int -> RenderbufferTarget -> ShowS
    $cshow :: RenderbufferTarget -> String
    show :: RenderbufferTarget -> String
    $cshowList :: [RenderbufferTarget] -> ShowS
    showList :: [RenderbufferTarget] -> ShowS
    Show )

    marshalRenderbufferTarget :: RenderbufferTarget -> GLenum
    marshalRenderbufferTarget :: RenderbufferTarget -> GLenum
    marshalRenderbufferTarget RenderbufferTarget
    x = case RenderbufferTarget
    x of
        RenderbufferTarget
    Renderbuffer -> GLenum
    GL_RENDERBUFFER

    -----------------------------------------------------------------------------

    getRBParameteriv :: RenderbufferTarget -> (GLint -> a) -> GLenum -> IO a
    getRBParameteriv :: forall a. RenderbufferTarget -> (GLint -> a) -> GLenum -> IO a
    getRBParameteriv RenderbufferTarget
    rbt GLint -> a
    f GLenum
    p =
       GLint -> (Ptr GLint -> IO a) -> IO a
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with GLint
    0 ((Ptr GLint -> IO a) -> IO a) -> (Ptr GLint -> IO a) -> IO a
    forall a b. (a -> b) -> a -> b
    $ \Ptr GLint
    buf -> do
          GLenum -> GLenum -> Ptr GLint -> IO ()
    forall (m :: * -> *).
    MonadIO m =>
    GLenum -> GLenum -> Ptr GLint -> m ()
    glGetRenderbufferParameteriv (RenderbufferTarget -> GLenum
    marshalRenderbufferTarget RenderbufferTarget
    rbt) GLenum
    p Ptr GLint
    buf
          (GLint -> a) -> Ptr GLint -> IO a
    forall a b. Storable a => (a -> b) -> Ptr a -> IO b
    peek1 GLint -> a
    f Ptr GLint
    buf
    -----------------------------------------------------------------------------

    newtype Samples = Samples GLsizei
       deriving ( Samples -> Samples -> Bool
    (Samples -> Samples -> Bool)
    -> (Samples -> Samples -> Bool) -> Eq Samples
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Samples -> Samples -> Bool
    == :: Samples -> Samples -> Bool
    $c/= :: Samples -> Samples -> Bool
    /= :: Samples -> Samples -> Bool
    Eq, Eq Samples
    Eq Samples =>
    (Samples -> Samples -> Ordering)
    -> (Samples -> Samples -> Bool)
    -> (Samples -> Samples -> Bool)
    -> (Samples -> Samples -> Bool)
    -> (Samples -> Samples -> Bool)
    -> (Samples -> Samples -> Samples)
    -> (Samples -> Samples -> Samples)
    -> Ord Samples
    Samples -> Samples -> Bool
    Samples -> Samples -> Ordering
    Samples -> Samples -> Samples
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Samples -> Samples -> Ordering
    compare :: Samples -> Samples -> Ordering
    $c< :: Samples -> Samples -> Bool
    < :: Samples -> Samples -> Bool
    $c<= :: Samples -> Samples -> Bool
    <= :: Samples -> Samples -> Bool
    $c> :: Samples -> Samples -> Bool
    > :: Samples -> Samples -> Bool
    $c>= :: Samples -> Samples -> Bool
    >= :: Samples -> Samples -> Bool
    $cmax :: Samples -> Samples -> Samples
    max :: Samples -> Samples -> Samples
    $cmin :: Samples -> Samples -> Samples
    min :: Samples -> Samples -> Samples
    Ord, Int -> Samples -> ShowS
    [Samples] -> ShowS
    Samples -> String
    (Int -> Samples -> ShowS)
    -> (Samples -> String) -> ([Samples] -> ShowS) -> Show Samples
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Samples -> ShowS
    showsPrec :: Int -> Samples -> ShowS
    $cshow :: Samples -> String
    show :: Samples -> String
    $cshowList :: [Samples] -> ShowS
    showList :: [Samples] -> ShowS
    Show )