-- GENERATED by C->Haskell Compiler, version 0.28.3 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/NanoVG/Internal/GL3.chs" #-}
module NanoVG.Internal.GL3 where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp



import qualified Data.Set as S
import           Data.Word
import           Foreign.C.Types

import           NanoVG.Internal.CreateContext
import           NanoVG.Internal.Types
import           NanoVG.Internal.Context
import           NanoVG.Internal.FFIHelpers

-- For now only the GL3 and the GLES3 backends are supported


-- We need to include this to define GLuint




createGL3 :: (S.Set CreateFlags) -> IO ((Context))
createGL3 :: Set CreateFlags -> IO Context
createGL3 Set CreateFlags
a1 =
  let {a1' :: CInt
a1' = Set CreateFlags -> CInt
forall a. Enum a => Set a -> CInt
bitMask Set CreateFlags
a1} in 
  CInt -> IO (Ptr ())
createGL3'_ CInt
a1' IO (Ptr ()) -> (Ptr () -> IO Context) -> IO Context
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Ptr ()
res ->
  let {res' :: Context
res' = Ptr () -> Context
fromPointer Ptr ()
res} in
  Context -> IO Context
forall (m :: * -> *) a. Monad m => a -> m a
return (Context
res')

{-# LINE 25 "src/NanoVG/Internal/GL3.chs" #-}

deleteGL3 :: (Context) -> IO ((Context))
deleteGL3 a1 =
  let {a1' = toPointer a1} in 
  deleteGL3'_ a1' >>
  let {a1'' = fromPointer  a1'} in 
  return (a1'')

{-# LINE 27 "src/NanoVG/Internal/GL3.chs" #-}


createImageFromHandleGL3 :: (Context) -> (GLuint) -> (CInt) -> (CInt) -> (CreateFlags) -> IO ((Image), (Context), (CreateFlags))
createImageFromHandleGL3 a1 a2 a3 a4 a5 =
  let {a1' = toPointer a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = toCInt a5} in 
  createImageFromHandleGL3'_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = Image res} in
  let {a1'' = fromPointer  a1'} in 
  let {a5'' = fromCInt  a5'} in 
  return (res', a1'', a5'')

{-# LINE 35 "src/NanoVG/Internal/GL3.chs" #-}


imageHandleGL3 :: (Context) -> (Image) -> IO ((GLuint), (Context))
imageHandleGL3 a1 a2 =
  let {a1' = toPointer a1} in 
  let {a2' = imageHandle a2} in 
  imageHandleGL3'_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  let {a1'' = fromPointer  a1'} in 
  return (res', a1'')

{-# LINE 40 "src/NanoVG/Internal/GL3.chs" #-}


foreign import ccall unsafe "NanoVG/Internal/GL3.chs.h nvgCreateGL3"
  createGL3'_ :: (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))

foreign import ccall unsafe "NanoVG/Internal/GL3.chs.h nvgDeleteGL3"
  deleteGL3'_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall unsafe "NanoVG/Internal/GL3.chs.h nvglCreateImageFromHandleGL3"
  createImageFromHandleGL3'_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO C2HSImp.CInt))))))

foreign import ccall unsafe "NanoVG/Internal/GL3.chs.h nvglImageHandleGL3"
  imageHandleGL3'_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CUInt)))