--------------------------------------------------------------------------------
-- |
-- Module      :  Graphics.Rendering.OpenGL.GL.Texturing.Specification
-- Copyright   :  (c) Sven Panne 2002-2019
-- License     :  BSD3
--
-- Maintainer  :  Sven Panne <svenpanne@gmail.com>
-- Stability   :  stable
-- Portability :  portable
--
-- This module corresponds to section 3.8.1 (Texture Image Specification),
-- section 3.8.2 (Alternate Texture Image Specification Commands), and section
-- 3.8.3 (Compressed Texture Images) of the OpenGL 2.1 specs.
--
--------------------------------------------------------------------------------

module Graphics.Rendering.OpenGL.GL.Texturing.Specification (
   -- * Texture Targets

   -- ** One-Dimensional Texture Targets
   TextureTarget1D(..),

   -- ** Two-Dimensional Texture Targets
   TextureTarget2D(..),
   TextureTarget2DMultisample(..),
   TextureTargetCubeMap(..),
   TextureTargetCubeMapFace(..),

   -- ** Three-Dimensional Texture Targets
   TextureTarget3D(..),
   TextureTarget2DMultisampleArray(..),

   -- ** Texture Buffer Target
   TextureTargetBuffer(..),

   -- ** Texture Target Classification
   BindableTextureTarget,
   ParameterizedTextureTarget,
   OneDimensionalTextureTarget,
   TwoDimensionalTextureTarget,
   ThreeDimensionalTextureTarget,
   QueryableTextureTarget,
   GettableTextureTarget,

   -- * Texture-related Data Types
   Level, Border,
   TexturePosition1D(..), TexturePosition2D(..), TexturePosition3D(..),
   TextureSize1D(..), TextureSize2D(..), TextureSize3D(..),

   -- * Texture Image Specification
   texImage1D, texImage2D, texImage3D,
   copyTexImage1D, copyTexImage2D,
   texSubImage1D, texSubImage2D, texSubImage3D,
   getTexImage,

   -- * Alternate Texture Image Specification Commands
   copyTexSubImage1D, copyTexSubImage2D, copyTexSubImage3D,

   -- * Compressed Texture Images
   CompressedTextureFormat(..), compressedTextureFormats,
   CompressedPixelData(..),
   compressedTexImage1D, compressedTexImage2D, compressedTexImage3D,
   compressedTexSubImage1D, compressedTexSubImage2D, compressedTexSubImage3D,
   getCompressedTexImage,

   -- * Multisample Texture Images
   SampleLocations(..), texImage2DMultisample, texImage3DMultisample,

   -- * Implementation-Dependent Limits
   maxTextureSize, maxCubeMapTextureSize, maxRectangleTextureSize,
   max3DTextureSize, maxArrayTextureLayers, maxSampleMaskWords,
   maxColorTextureSamples, maxDepthTextureSamples, maxIntegerSamples
) where

import Foreign.Ptr
import Data.StateVar
import Graphics.Rendering.OpenGL.GL.CoordTrans
import Graphics.Rendering.OpenGL.GL.FramebufferObjects.RenderbufferTarget
import Graphics.Rendering.OpenGL.GL.GLboolean
import Graphics.Rendering.OpenGL.GL.PixelData
import Graphics.Rendering.OpenGL.GL.PixelRectangles
import Graphics.Rendering.OpenGL.GL.QueryUtils
import Graphics.Rendering.OpenGL.GL.Texturing.PixelInternalFormat
import Graphics.Rendering.OpenGL.GL.Texturing.TextureTarget
import Graphics.GL

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

type Level = GLint

type Border = GLint

newtype TexturePosition1D = TexturePosition1D GLint
   deriving ( TexturePosition1D -> TexturePosition1D -> Bool
(TexturePosition1D -> TexturePosition1D -> Bool)
-> (TexturePosition1D -> TexturePosition1D -> Bool)
-> Eq TexturePosition1D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TexturePosition1D -> TexturePosition1D -> Bool
$c/= :: TexturePosition1D -> TexturePosition1D -> Bool
== :: TexturePosition1D -> TexturePosition1D -> Bool
$c== :: TexturePosition1D -> TexturePosition1D -> Bool
Eq, Eq TexturePosition1D
Eq TexturePosition1D =>
(TexturePosition1D -> TexturePosition1D -> Ordering)
-> (TexturePosition1D -> TexturePosition1D -> Bool)
-> (TexturePosition1D -> TexturePosition1D -> Bool)
-> (TexturePosition1D -> TexturePosition1D -> Bool)
-> (TexturePosition1D -> TexturePosition1D -> Bool)
-> (TexturePosition1D -> TexturePosition1D -> TexturePosition1D)
-> (TexturePosition1D -> TexturePosition1D -> TexturePosition1D)
-> Ord TexturePosition1D
TexturePosition1D -> TexturePosition1D -> Bool
TexturePosition1D -> TexturePosition1D -> Ordering
TexturePosition1D -> TexturePosition1D -> TexturePosition1D
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
min :: TexturePosition1D -> TexturePosition1D -> TexturePosition1D
$cmin :: TexturePosition1D -> TexturePosition1D -> TexturePosition1D
max :: TexturePosition1D -> TexturePosition1D -> TexturePosition1D
$cmax :: TexturePosition1D -> TexturePosition1D -> TexturePosition1D
>= :: TexturePosition1D -> TexturePosition1D -> Bool
$c>= :: TexturePosition1D -> TexturePosition1D -> Bool
> :: TexturePosition1D -> TexturePosition1D -> Bool
$c> :: TexturePosition1D -> TexturePosition1D -> Bool
<= :: TexturePosition1D -> TexturePosition1D -> Bool
$c<= :: TexturePosition1D -> TexturePosition1D -> Bool
< :: TexturePosition1D -> TexturePosition1D -> Bool
$c< :: TexturePosition1D -> TexturePosition1D -> Bool
compare :: TexturePosition1D -> TexturePosition1D -> Ordering
$ccompare :: TexturePosition1D -> TexturePosition1D -> Ordering
$cp1Ord :: Eq TexturePosition1D
Ord, Int -> TexturePosition1D -> ShowS
[TexturePosition1D] -> ShowS
TexturePosition1D -> String
(Int -> TexturePosition1D -> ShowS)
-> (TexturePosition1D -> String)
-> ([TexturePosition1D] -> ShowS)
-> Show TexturePosition1D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TexturePosition1D] -> ShowS
$cshowList :: [TexturePosition1D] -> ShowS
show :: TexturePosition1D -> String
$cshow :: TexturePosition1D -> String
showsPrec :: Int -> TexturePosition1D -> ShowS
$cshowsPrec :: Int -> TexturePosition1D -> ShowS
Show )

data TexturePosition2D = TexturePosition2D !GLint !GLint
   deriving ( TexturePosition2D -> TexturePosition2D -> Bool
(TexturePosition2D -> TexturePosition2D -> Bool)
-> (TexturePosition2D -> TexturePosition2D -> Bool)
-> Eq TexturePosition2D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TexturePosition2D -> TexturePosition2D -> Bool
$c/= :: TexturePosition2D -> TexturePosition2D -> Bool
== :: TexturePosition2D -> TexturePosition2D -> Bool
$c== :: TexturePosition2D -> TexturePosition2D -> Bool
Eq, Eq TexturePosition2D
Eq TexturePosition2D =>
(TexturePosition2D -> TexturePosition2D -> Ordering)
-> (TexturePosition2D -> TexturePosition2D -> Bool)
-> (TexturePosition2D -> TexturePosition2D -> Bool)
-> (TexturePosition2D -> TexturePosition2D -> Bool)
-> (TexturePosition2D -> TexturePosition2D -> Bool)
-> (TexturePosition2D -> TexturePosition2D -> TexturePosition2D)
-> (TexturePosition2D -> TexturePosition2D -> TexturePosition2D)
-> Ord TexturePosition2D
TexturePosition2D -> TexturePosition2D -> Bool
TexturePosition2D -> TexturePosition2D -> Ordering
TexturePosition2D -> TexturePosition2D -> TexturePosition2D
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
min :: TexturePosition2D -> TexturePosition2D -> TexturePosition2D
$cmin :: TexturePosition2D -> TexturePosition2D -> TexturePosition2D
max :: TexturePosition2D -> TexturePosition2D -> TexturePosition2D
$cmax :: TexturePosition2D -> TexturePosition2D -> TexturePosition2D
>= :: TexturePosition2D -> TexturePosition2D -> Bool
$c>= :: TexturePosition2D -> TexturePosition2D -> Bool
> :: TexturePosition2D -> TexturePosition2D -> Bool
$c> :: TexturePosition2D -> TexturePosition2D -> Bool
<= :: TexturePosition2D -> TexturePosition2D -> Bool
$c<= :: TexturePosition2D -> TexturePosition2D -> Bool
< :: TexturePosition2D -> TexturePosition2D -> Bool
$c< :: TexturePosition2D -> TexturePosition2D -> Bool
compare :: TexturePosition2D -> TexturePosition2D -> Ordering
$ccompare :: TexturePosition2D -> TexturePosition2D -> Ordering
$cp1Ord :: Eq TexturePosition2D
Ord, Int -> TexturePosition2D -> ShowS
[TexturePosition2D] -> ShowS
TexturePosition2D -> String
(Int -> TexturePosition2D -> ShowS)
-> (TexturePosition2D -> String)
-> ([TexturePosition2D] -> ShowS)
-> Show TexturePosition2D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TexturePosition2D] -> ShowS
$cshowList :: [TexturePosition2D] -> ShowS
show :: TexturePosition2D -> String
$cshow :: TexturePosition2D -> String
showsPrec :: Int -> TexturePosition2D -> ShowS
$cshowsPrec :: Int -> TexturePosition2D -> ShowS
Show )

data TexturePosition3D = TexturePosition3D !GLint !GLint !GLint
   deriving ( TexturePosition3D -> TexturePosition3D -> Bool
(TexturePosition3D -> TexturePosition3D -> Bool)
-> (TexturePosition3D -> TexturePosition3D -> Bool)
-> Eq TexturePosition3D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TexturePosition3D -> TexturePosition3D -> Bool
$c/= :: TexturePosition3D -> TexturePosition3D -> Bool
== :: TexturePosition3D -> TexturePosition3D -> Bool
$c== :: TexturePosition3D -> TexturePosition3D -> Bool
Eq, Eq TexturePosition3D
Eq TexturePosition3D =>
(TexturePosition3D -> TexturePosition3D -> Ordering)
-> (TexturePosition3D -> TexturePosition3D -> Bool)
-> (TexturePosition3D -> TexturePosition3D -> Bool)
-> (TexturePosition3D -> TexturePosition3D -> Bool)
-> (TexturePosition3D -> TexturePosition3D -> Bool)
-> (TexturePosition3D -> TexturePosition3D -> TexturePosition3D)
-> (TexturePosition3D -> TexturePosition3D -> TexturePosition3D)
-> Ord TexturePosition3D
TexturePosition3D -> TexturePosition3D -> Bool
TexturePosition3D -> TexturePosition3D -> Ordering
TexturePosition3D -> TexturePosition3D -> TexturePosition3D
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
min :: TexturePosition3D -> TexturePosition3D -> TexturePosition3D
$cmin :: TexturePosition3D -> TexturePosition3D -> TexturePosition3D
max :: TexturePosition3D -> TexturePosition3D -> TexturePosition3D
$cmax :: TexturePosition3D -> TexturePosition3D -> TexturePosition3D
>= :: TexturePosition3D -> TexturePosition3D -> Bool
$c>= :: TexturePosition3D -> TexturePosition3D -> Bool
> :: TexturePosition3D -> TexturePosition3D -> Bool
$c> :: TexturePosition3D -> TexturePosition3D -> Bool
<= :: TexturePosition3D -> TexturePosition3D -> Bool
$c<= :: TexturePosition3D -> TexturePosition3D -> Bool
< :: TexturePosition3D -> TexturePosition3D -> Bool
$c< :: TexturePosition3D -> TexturePosition3D -> Bool
compare :: TexturePosition3D -> TexturePosition3D -> Ordering
$ccompare :: TexturePosition3D -> TexturePosition3D -> Ordering
$cp1Ord :: Eq TexturePosition3D
Ord, Int -> TexturePosition3D -> ShowS
[TexturePosition3D] -> ShowS
TexturePosition3D -> String
(Int -> TexturePosition3D -> ShowS)
-> (TexturePosition3D -> String)
-> ([TexturePosition3D] -> ShowS)
-> Show TexturePosition3D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TexturePosition3D] -> ShowS
$cshowList :: [TexturePosition3D] -> ShowS
show :: TexturePosition3D -> String
$cshow :: TexturePosition3D -> String
showsPrec :: Int -> TexturePosition3D -> ShowS
$cshowsPrec :: Int -> TexturePosition3D -> ShowS
Show )

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

data TextureSize2D = TextureSize2D !GLsizei !GLsizei
   deriving ( TextureSize2D -> TextureSize2D -> Bool
(TextureSize2D -> TextureSize2D -> Bool)
-> (TextureSize2D -> TextureSize2D -> Bool) -> Eq TextureSize2D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextureSize2D -> TextureSize2D -> Bool
$c/= :: TextureSize2D -> TextureSize2D -> Bool
== :: TextureSize2D -> TextureSize2D -> Bool
$c== :: TextureSize2D -> TextureSize2D -> Bool
Eq, Eq TextureSize2D
Eq TextureSize2D =>
(TextureSize2D -> TextureSize2D -> Ordering)
-> (TextureSize2D -> TextureSize2D -> Bool)
-> (TextureSize2D -> TextureSize2D -> Bool)
-> (TextureSize2D -> TextureSize2D -> Bool)
-> (TextureSize2D -> TextureSize2D -> Bool)
-> (TextureSize2D -> TextureSize2D -> TextureSize2D)
-> (TextureSize2D -> TextureSize2D -> TextureSize2D)
-> Ord TextureSize2D
TextureSize2D -> TextureSize2D -> Bool
TextureSize2D -> TextureSize2D -> Ordering
TextureSize2D -> TextureSize2D -> TextureSize2D
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
min :: TextureSize2D -> TextureSize2D -> TextureSize2D
$cmin :: TextureSize2D -> TextureSize2D -> TextureSize2D
max :: TextureSize2D -> TextureSize2D -> TextureSize2D
$cmax :: TextureSize2D -> TextureSize2D -> TextureSize2D
>= :: TextureSize2D -> TextureSize2D -> Bool
$c>= :: TextureSize2D -> TextureSize2D -> Bool
> :: TextureSize2D -> TextureSize2D -> Bool
$c> :: TextureSize2D -> TextureSize2D -> Bool
<= :: TextureSize2D -> TextureSize2D -> Bool
$c<= :: TextureSize2D -> TextureSize2D -> Bool
< :: TextureSize2D -> TextureSize2D -> Bool
$c< :: TextureSize2D -> TextureSize2D -> Bool
compare :: TextureSize2D -> TextureSize2D -> Ordering
$ccompare :: TextureSize2D -> TextureSize2D -> Ordering
$cp1Ord :: Eq TextureSize2D
Ord, Int -> TextureSize2D -> ShowS
[TextureSize2D] -> ShowS
TextureSize2D -> String
(Int -> TextureSize2D -> ShowS)
-> (TextureSize2D -> String)
-> ([TextureSize2D] -> ShowS)
-> Show TextureSize2D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextureSize2D] -> ShowS
$cshowList :: [TextureSize2D] -> ShowS
show :: TextureSize2D -> String
$cshow :: TextureSize2D -> String
showsPrec :: Int -> TextureSize2D -> ShowS
$cshowsPrec :: Int -> TextureSize2D -> ShowS
Show )

data TextureSize3D = TextureSize3D !GLsizei !GLsizei !GLsizei
   deriving ( TextureSize3D -> TextureSize3D -> Bool
(TextureSize3D -> TextureSize3D -> Bool)
-> (TextureSize3D -> TextureSize3D -> Bool) -> Eq TextureSize3D
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TextureSize3D -> TextureSize3D -> Bool
$c/= :: TextureSize3D -> TextureSize3D -> Bool
== :: TextureSize3D -> TextureSize3D -> Bool
$c== :: TextureSize3D -> TextureSize3D -> Bool
Eq, Eq TextureSize3D
Eq TextureSize3D =>
(TextureSize3D -> TextureSize3D -> Ordering)
-> (TextureSize3D -> TextureSize3D -> Bool)
-> (TextureSize3D -> TextureSize3D -> Bool)
-> (TextureSize3D -> TextureSize3D -> Bool)
-> (TextureSize3D -> TextureSize3D -> Bool)
-> (TextureSize3D -> TextureSize3D -> TextureSize3D)
-> (TextureSize3D -> TextureSize3D -> TextureSize3D)
-> Ord TextureSize3D
TextureSize3D -> TextureSize3D -> Bool
TextureSize3D -> TextureSize3D -> Ordering
TextureSize3D -> TextureSize3D -> TextureSize3D
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
min :: TextureSize3D -> TextureSize3D -> TextureSize3D
$cmin :: TextureSize3D -> TextureSize3D -> TextureSize3D
max :: TextureSize3D -> TextureSize3D -> TextureSize3D
$cmax :: TextureSize3D -> TextureSize3D -> TextureSize3D
>= :: TextureSize3D -> TextureSize3D -> Bool
$c>= :: TextureSize3D -> TextureSize3D -> Bool
> :: TextureSize3D -> TextureSize3D -> Bool
$c> :: TextureSize3D -> TextureSize3D -> Bool
<= :: TextureSize3D -> TextureSize3D -> Bool
$c<= :: TextureSize3D -> TextureSize3D -> Bool
< :: TextureSize3D -> TextureSize3D -> Bool
$c< :: TextureSize3D -> TextureSize3D -> Bool
compare :: TextureSize3D -> TextureSize3D -> Ordering
$ccompare :: TextureSize3D -> TextureSize3D -> Ordering
$cp1Ord :: Eq TextureSize3D
Ord, Int -> TextureSize3D -> ShowS
[TextureSize3D] -> ShowS
TextureSize3D -> String
(Int -> TextureSize3D -> ShowS)
-> (TextureSize3D -> String)
-> ([TextureSize3D] -> ShowS)
-> Show TextureSize3D
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TextureSize3D] -> ShowS
$cshowList :: [TextureSize3D] -> ShowS
show :: TextureSize3D -> String
$cshow :: TextureSize3D -> String
showsPrec :: Int -> TextureSize3D -> ShowS
$cshowsPrec :: Int -> TextureSize3D -> ShowS
Show )

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

texImage1D :: OneDimensionalTextureTarget t => t -> Proxy -> Level -> PixelInternalFormat -> TextureSize1D -> Border -> PixelData a -> IO ()
texImage1D :: t
-> Proxy
-> Level
-> PixelInternalFormat
-> TextureSize1D
-> Level
-> PixelData a
-> IO ()
texImage1D target :: t
target proxy :: Proxy
proxy level :: Level
level int :: PixelInternalFormat
int (TextureSize1D w :: Level
w) border :: Level
border pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> m ()
glTexImage1D
         (Proxy -> t -> GLenum
forall t. OneDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalOneDimensionalTextureTarget Proxy
proxy t
target)
         Level
level (PixelInternalFormat -> Level
marshalPixelInternalFormat PixelInternalFormat
int) Level
w Level
border

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

texImage2D :: TwoDimensionalTextureTarget t => t -> Proxy -> Level -> PixelInternalFormat -> TextureSize2D -> Border -> PixelData a -> IO ()
texImage2D :: t
-> Proxy
-> Level
-> PixelInternalFormat
-> TextureSize2D
-> Level
-> PixelData a
-> IO ()
texImage2D target :: t
target proxy :: Proxy
proxy level :: Level
level int :: PixelInternalFormat
int (TextureSize2D w :: Level
w h :: Level
h) border :: Level
border pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> m ()
glTexImage2D (Proxy -> t -> GLenum
forall t. TwoDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalTwoDimensionalTextureTarget Proxy
proxy t
target) Level
level (PixelInternalFormat -> Level
marshalPixelInternalFormat PixelInternalFormat
int) Level
w Level
h Level
border

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

texImage3D :: ThreeDimensionalTextureTarget t => t -> Proxy -> Level -> PixelInternalFormat -> TextureSize3D -> Border -> PixelData a -> IO ()
texImage3D :: t
-> Proxy
-> Level
-> PixelInternalFormat
-> TextureSize3D
-> Level
-> PixelData a
-> IO ()
texImage3D target :: t
target proxy :: Proxy
proxy level :: Level
level int :: PixelInternalFormat
int (TextureSize3D w :: Level
w h :: Level
h d :: Level
d) border :: Level
border pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> m ()
glTexImage3D
         (Proxy -> t -> GLenum
forall t. ThreeDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalThreeDimensionalTextureTarget Proxy
proxy t
target)
         Level
level (PixelInternalFormat -> Level
marshalPixelInternalFormat PixelInternalFormat
int) Level
w Level
h Level
d Level
border

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

getTexImage :: GettableTextureTarget t => t -> Level -> PixelData a -> IO ()
getTexImage :: t -> Level -> PixelData a -> IO ()
getTexImage target :: t
target level :: Level
level pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum -> Level -> GLenum -> GLenum -> Ptr a -> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum -> Level -> GLenum -> GLenum -> Ptr a -> m ()
glGetTexImage (t -> GLenum
forall t. GettableTextureTarget t => t -> GLenum
marshalGettableTextureTarget t
target) Level
level

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

copyTexImage1D :: OneDimensionalTextureTarget t => t -> Level -> PixelInternalFormat -> Position -> TextureSize1D -> Border -> IO ()
copyTexImage1D :: t
-> Level
-> PixelInternalFormat
-> Position
-> TextureSize1D
-> Level
-> IO ()
copyTexImage1D target :: t
target level :: Level
level int :: PixelInternalFormat
int (Position x :: Level
x y :: Level
y) (TextureSize1D w :: Level
w) border :: Level
border =
   GLenum
-> Level -> GLenum -> Level -> Level -> Level -> Level -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum
-> Level -> GLenum -> Level -> Level -> Level -> Level -> m ()
glCopyTexImage1D
      (Proxy -> t -> GLenum
forall t. OneDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalOneDimensionalTextureTarget Proxy
NoProxy t
target) Level
level
      (PixelInternalFormat -> GLenum
marshalPixelInternalFormat' PixelInternalFormat
int) Level
x Level
y Level
w Level
border

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

copyTexImage2D :: TwoDimensionalTextureTarget t => t -> Level -> PixelInternalFormat -> Position -> TextureSize2D -> Border -> IO ()
copyTexImage2D :: t
-> Level
-> PixelInternalFormat
-> Position
-> TextureSize2D
-> Level
-> IO ()
copyTexImage2D target :: t
target level :: Level
level int :: PixelInternalFormat
int (Position x :: Level
x y :: Level
y) (TextureSize2D w :: Level
w h :: Level
h) border :: Level
border =
   GLenum
-> Level
-> GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum
-> Level
-> GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> m ()
glCopyTexImage2D
      (Proxy -> t -> GLenum
forall t. TwoDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalTwoDimensionalTextureTarget Proxy
NoProxy t
target) Level
level
      (PixelInternalFormat -> GLenum
marshalPixelInternalFormat' PixelInternalFormat
int) Level
x Level
y Level
w Level
h Level
border

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

texSubImage1D :: OneDimensionalTextureTarget t => t -> Level -> TexturePosition1D -> TextureSize1D -> PixelData a -> IO ()
texSubImage1D :: t
-> Level
-> TexturePosition1D
-> TextureSize1D
-> PixelData a
-> IO ()
texSubImage1D target :: t
target level :: Level
level (TexturePosition1D xOff :: Level
xOff) (TextureSize1D w :: Level
w) pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level -> Level -> Level -> GLenum -> GLenum -> Ptr a -> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level -> Level -> Level -> GLenum -> GLenum -> Ptr a -> m ()
glTexSubImage1D (Proxy -> t -> GLenum
forall t. OneDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalOneDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
w

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

texSubImage2D :: TwoDimensionalTextureTarget t => t -> Level -> TexturePosition2D -> TextureSize2D -> PixelData a -> IO ()
texSubImage2D :: t
-> Level
-> TexturePosition2D
-> TextureSize2D
-> PixelData a
-> IO ()
texSubImage2D target :: t
target level :: Level
level (TexturePosition2D xOff :: Level
xOff yOff :: Level
yOff) (TextureSize2D w :: Level
w h :: Level
h) pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> m ()
glTexSubImage2D (Proxy -> t -> GLenum
forall t. TwoDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalTwoDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
yOff Level
w Level
h

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

texSubImage3D :: ThreeDimensionalTextureTarget t => t -> Level -> TexturePosition3D -> TextureSize3D -> PixelData a -> IO ()
texSubImage3D :: t
-> Level
-> TexturePosition3D
-> TextureSize3D
-> PixelData a
-> IO ()
texSubImage3D target :: t
target level :: Level
level (TexturePosition3D xOff :: Level
xOff yOff :: Level
yOff zOff :: Level
zOff) (TextureSize3D w :: Level
w h :: Level
h d :: Level
d) pd :: PixelData a
pd =
   PixelData a -> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. PixelData a -> (GLenum -> GLenum -> Ptr a -> b) -> b
withPixelData PixelData a
pd ((GLenum -> GLenum -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> GLenum -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> GLenum
-> Ptr a
-> m ()
glTexSubImage3D (Proxy -> t -> GLenum
forall t. ThreeDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalThreeDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
yOff Level
zOff Level
w Level
h Level
d

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

copyTexSubImage1D :: OneDimensionalTextureTarget t => t -> Level -> TexturePosition1D -> Position -> TextureSize1D -> IO ()
copyTexSubImage1D :: t
-> Level -> TexturePosition1D -> Position -> TextureSize1D -> IO ()
copyTexSubImage1D target :: t
target level :: Level
level (TexturePosition1D xOff :: Level
xOff) (Position x :: Level
x y :: Level
y) (TextureSize1D w :: Level
w) =
   GLenum -> Level -> Level -> Level -> Level -> Level -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum -> Level -> Level -> Level -> Level -> Level -> m ()
glCopyTexSubImage1D (Proxy -> t -> GLenum
forall t. OneDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalOneDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
x Level
y Level
w

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

copyTexSubImage2D :: TwoDimensionalTextureTarget t => t -> Level -> TexturePosition2D -> Position -> TextureSize2D -> IO ()
copyTexSubImage2D :: t
-> Level -> TexturePosition2D -> Position -> TextureSize2D -> IO ()
copyTexSubImage2D target :: t
target level :: Level
level (TexturePosition2D xOff :: Level
xOff yOff :: Level
yOff) (Position x :: Level
x y :: Level
y) (TextureSize2D w :: Level
w h :: Level
h) =
   GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> m ()
glCopyTexSubImage2D (Proxy -> t -> GLenum
forall t. TwoDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalTwoDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
yOff Level
x Level
y Level
w Level
h

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

copyTexSubImage3D :: ThreeDimensionalTextureTarget t => t -> Level -> TexturePosition3D -> Position -> TextureSize2D -> IO ()
copyTexSubImage3D :: t
-> Level -> TexturePosition3D -> Position -> TextureSize2D -> IO ()
copyTexSubImage3D target :: t
target level :: Level
level (TexturePosition3D xOff :: Level
xOff yOff :: Level
yOff zOff :: Level
zOff) (Position x :: Level
x y :: Level
y) (TextureSize2D w :: Level
w h :: Level
h) =
   GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> m ()
glCopyTexSubImage3D (Proxy -> t -> GLenum
forall t. ThreeDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalThreeDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
yOff Level
zOff Level
x Level
y Level
w Level
h

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

newtype CompressedTextureFormat = CompressedTextureFormat GLenum
   deriving ( CompressedTextureFormat -> CompressedTextureFormat -> Bool
(CompressedTextureFormat -> CompressedTextureFormat -> Bool)
-> (CompressedTextureFormat -> CompressedTextureFormat -> Bool)
-> Eq CompressedTextureFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
$c/= :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
== :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
$c== :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
Eq, Eq CompressedTextureFormat
Eq CompressedTextureFormat =>
(CompressedTextureFormat -> CompressedTextureFormat -> Ordering)
-> (CompressedTextureFormat -> CompressedTextureFormat -> Bool)
-> (CompressedTextureFormat -> CompressedTextureFormat -> Bool)
-> (CompressedTextureFormat -> CompressedTextureFormat -> Bool)
-> (CompressedTextureFormat -> CompressedTextureFormat -> Bool)
-> (CompressedTextureFormat
    -> CompressedTextureFormat -> CompressedTextureFormat)
-> (CompressedTextureFormat
    -> CompressedTextureFormat -> CompressedTextureFormat)
-> Ord CompressedTextureFormat
CompressedTextureFormat -> CompressedTextureFormat -> Bool
CompressedTextureFormat -> CompressedTextureFormat -> Ordering
CompressedTextureFormat
-> CompressedTextureFormat -> CompressedTextureFormat
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
min :: CompressedTextureFormat
-> CompressedTextureFormat -> CompressedTextureFormat
$cmin :: CompressedTextureFormat
-> CompressedTextureFormat -> CompressedTextureFormat
max :: CompressedTextureFormat
-> CompressedTextureFormat -> CompressedTextureFormat
$cmax :: CompressedTextureFormat
-> CompressedTextureFormat -> CompressedTextureFormat
>= :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
$c>= :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
> :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
$c> :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
<= :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
$c<= :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
< :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
$c< :: CompressedTextureFormat -> CompressedTextureFormat -> Bool
compare :: CompressedTextureFormat -> CompressedTextureFormat -> Ordering
$ccompare :: CompressedTextureFormat -> CompressedTextureFormat -> Ordering
$cp1Ord :: Eq CompressedTextureFormat
Ord, Int -> CompressedTextureFormat -> ShowS
[CompressedTextureFormat] -> ShowS
CompressedTextureFormat -> String
(Int -> CompressedTextureFormat -> ShowS)
-> (CompressedTextureFormat -> String)
-> ([CompressedTextureFormat] -> ShowS)
-> Show CompressedTextureFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompressedTextureFormat] -> ShowS
$cshowList :: [CompressedTextureFormat] -> ShowS
show :: CompressedTextureFormat -> String
$cshow :: CompressedTextureFormat -> String
showsPrec :: Int -> CompressedTextureFormat -> ShowS
$cshowsPrec :: Int -> CompressedTextureFormat -> ShowS
Show )

compressedTextureFormats :: GettableStateVar [CompressedTextureFormat]
compressedTextureFormats :: GettableStateVar [CompressedTextureFormat]
compressedTextureFormats =
   GettableStateVar [CompressedTextureFormat]
-> GettableStateVar [CompressedTextureFormat]
forall a. IO a -> IO a
makeGettableStateVar (GettableStateVar [CompressedTextureFormat]
 -> GettableStateVar [CompressedTextureFormat])
-> GettableStateVar [CompressedTextureFormat]
-> GettableStateVar [CompressedTextureFormat]
forall a b. (a -> b) -> a -> b
$ do
      Int
n <- (Level -> Int) -> PName1I -> IO Int
forall p a. GetPName1I p => (Level -> a) -> p -> IO a
getInteger1 Level -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral PName1I
GetNumCompressedTextureFormats
      (GLenum -> CompressedTextureFormat)
-> PNameNI -> Int -> GettableStateVar [CompressedTextureFormat]
forall p a. GetPNameNI p => (GLenum -> a) -> p -> Int -> IO [a]
getEnumN GLenum -> CompressedTextureFormat
CompressedTextureFormat PNameNI
GetCompressedTextureFormats Int
n

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

data CompressedPixelData a =
     CompressedPixelData !CompressedTextureFormat GLsizei (Ptr a)
   deriving ( CompressedPixelData a -> CompressedPixelData a -> Bool
(CompressedPixelData a -> CompressedPixelData a -> Bool)
-> (CompressedPixelData a -> CompressedPixelData a -> Bool)
-> Eq (CompressedPixelData a)
forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompressedPixelData a -> CompressedPixelData a -> Bool
$c/= :: forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
== :: CompressedPixelData a -> CompressedPixelData a -> Bool
$c== :: forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
Eq, Eq (CompressedPixelData a)
Eq (CompressedPixelData a) =>
(CompressedPixelData a -> CompressedPixelData a -> Ordering)
-> (CompressedPixelData a -> CompressedPixelData a -> Bool)
-> (CompressedPixelData a -> CompressedPixelData a -> Bool)
-> (CompressedPixelData a -> CompressedPixelData a -> Bool)
-> (CompressedPixelData a -> CompressedPixelData a -> Bool)
-> (CompressedPixelData a
    -> CompressedPixelData a -> CompressedPixelData a)
-> (CompressedPixelData a
    -> CompressedPixelData a -> CompressedPixelData a)
-> Ord (CompressedPixelData a)
CompressedPixelData a -> CompressedPixelData a -> Bool
CompressedPixelData a -> CompressedPixelData a -> Ordering
CompressedPixelData a
-> CompressedPixelData a -> CompressedPixelData a
forall a. Eq (CompressedPixelData a)
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
forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
forall a.
CompressedPixelData a -> CompressedPixelData a -> Ordering
forall a.
CompressedPixelData a
-> CompressedPixelData a -> CompressedPixelData a
min :: CompressedPixelData a
-> CompressedPixelData a -> CompressedPixelData a
$cmin :: forall a.
CompressedPixelData a
-> CompressedPixelData a -> CompressedPixelData a
max :: CompressedPixelData a
-> CompressedPixelData a -> CompressedPixelData a
$cmax :: forall a.
CompressedPixelData a
-> CompressedPixelData a -> CompressedPixelData a
>= :: CompressedPixelData a -> CompressedPixelData a -> Bool
$c>= :: forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
> :: CompressedPixelData a -> CompressedPixelData a -> Bool
$c> :: forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
<= :: CompressedPixelData a -> CompressedPixelData a -> Bool
$c<= :: forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
< :: CompressedPixelData a -> CompressedPixelData a -> Bool
$c< :: forall a. CompressedPixelData a -> CompressedPixelData a -> Bool
compare :: CompressedPixelData a -> CompressedPixelData a -> Ordering
$ccompare :: forall a.
CompressedPixelData a -> CompressedPixelData a -> Ordering
$cp1Ord :: forall a. Eq (CompressedPixelData a)
Ord, Int -> CompressedPixelData a -> ShowS
[CompressedPixelData a] -> ShowS
CompressedPixelData a -> String
(Int -> CompressedPixelData a -> ShowS)
-> (CompressedPixelData a -> String)
-> ([CompressedPixelData a] -> ShowS)
-> Show (CompressedPixelData a)
forall a. Int -> CompressedPixelData a -> ShowS
forall a. [CompressedPixelData a] -> ShowS
forall a. CompressedPixelData a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompressedPixelData a] -> ShowS
$cshowList :: forall a. [CompressedPixelData a] -> ShowS
show :: CompressedPixelData a -> String
$cshow :: forall a. CompressedPixelData a -> String
showsPrec :: Int -> CompressedPixelData a -> ShowS
$cshowsPrec :: forall a. Int -> CompressedPixelData a -> ShowS
Show )

withCompressedPixelData ::
   CompressedPixelData a -> (GLenum -> GLsizei -> Ptr a -> b) -> b
withCompressedPixelData :: CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData
   (CompressedPixelData (CompressedTextureFormat fmt :: GLenum
fmt) size :: Level
size ptr :: Ptr a
ptr) f :: GLenum -> Level -> Ptr a -> b
f =
   GLenum -> Level -> Ptr a -> b
f GLenum
fmt Level
size Ptr a
ptr

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

compressedTexImage1D :: OneDimensionalTextureTarget t => t -> Proxy -> Level -> TextureSize1D -> Border -> CompressedPixelData a -> IO ()
compressedTexImage1D :: t
-> Proxy
-> Level
-> TextureSize1D
-> Level
-> CompressedPixelData a
-> IO ()
compressedTexImage1D target :: t
target proxy :: Proxy
proxy level :: Level
level (TextureSize1D w :: Level
w) border :: Level
border cpd :: CompressedPixelData a
cpd =
   CompressedPixelData a
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b.
CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData CompressedPixelData a
cpd ((GLenum -> Level -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \fmt :: GLenum
fmt ->
      GLenum
-> Level -> GLenum -> Level -> Level -> Level -> Ptr a -> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level -> GLenum -> Level -> Level -> Level -> Ptr a -> m ()
glCompressedTexImage1D
         (Proxy -> t -> GLenum
forall t. OneDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalOneDimensionalTextureTarget Proxy
proxy t
target) Level
level GLenum
fmt Level
w Level
border

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

-- Note that the spec currently disallows TextureRectangle, but then again the
-- extension specification explicitly allows a relaxation in the future.
compressedTexImage2D :: TwoDimensionalTextureTarget t => t -> Proxy -> Level -> TextureSize2D -> Border -> CompressedPixelData a -> IO ()
compressedTexImage2D :: t
-> Proxy
-> Level
-> TextureSize2D
-> Level
-> CompressedPixelData a
-> IO ()
compressedTexImage2D target :: t
target proxy :: Proxy
proxy level :: Level
level (TextureSize2D w :: Level
w h :: Level
h) border :: Level
border cpd :: CompressedPixelData a
cpd =
   CompressedPixelData a
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b.
CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData CompressedPixelData a
cpd ((GLenum -> Level -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \fmt :: GLenum
fmt ->
      GLenum
-> Level
-> GLenum
-> Level
-> Level
-> Level
-> Level
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> GLenum
-> Level
-> Level
-> Level
-> Level
-> Ptr a
-> m ()
glCompressedTexImage2D (Proxy -> t -> GLenum
forall t. TwoDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalTwoDimensionalTextureTarget Proxy
proxy t
target) Level
level GLenum
fmt Level
w Level
h Level
border

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

compressedTexImage3D :: ThreeDimensionalTextureTarget t => t -> Proxy -> Level -> TextureSize3D -> Border -> CompressedPixelData a -> IO ()
compressedTexImage3D :: t
-> Proxy
-> Level
-> TextureSize3D
-> Level
-> CompressedPixelData a
-> IO ()
compressedTexImage3D target :: t
target proxy :: Proxy
proxy level :: Level
level (TextureSize3D w :: Level
w h :: Level
h d :: Level
d) border :: Level
border cpd :: CompressedPixelData a
cpd =
   CompressedPixelData a
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b.
CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData CompressedPixelData a
cpd ((GLenum -> Level -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \fmt :: GLenum
fmt ->
      GLenum
-> Level
-> GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Ptr a
-> m ()
glCompressedTexImage3D
         (Proxy -> t -> GLenum
forall t. ThreeDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalThreeDimensionalTextureTarget Proxy
proxy t
target) Level
level GLenum
fmt Level
w Level
h Level
d Level
border

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

getCompressedTexImage :: GettableTextureTarget t => t -> Level -> Ptr a -> IO ()
getCompressedTexImage :: t -> Level -> Ptr a -> IO ()
getCompressedTexImage = GLenum -> Level -> Ptr a -> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum -> Level -> Ptr a -> m ()
glGetCompressedTexImage (GLenum -> Level -> Ptr a -> IO ())
-> (t -> GLenum) -> t -> Level -> Ptr a -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t -> GLenum
forall t. GettableTextureTarget t => t -> GLenum
marshalGettableTextureTarget

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

compressedTexSubImage1D :: OneDimensionalTextureTarget t => t -> Level -> TexturePosition1D -> TextureSize1D -> CompressedPixelData a -> IO ()
compressedTexSubImage1D :: t
-> Level
-> TexturePosition1D
-> TextureSize1D
-> CompressedPixelData a
-> IO ()
compressedTexSubImage1D target :: t
target level :: Level
level (TexturePosition1D xOff :: Level
xOff) (TextureSize1D w :: Level
w) cpd :: CompressedPixelData a
cpd =
   CompressedPixelData a
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b.
CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData CompressedPixelData a
cpd ((GLenum -> Level -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level -> Level -> Level -> GLenum -> Level -> Ptr a -> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level -> Level -> Level -> GLenum -> Level -> Ptr a -> m ()
glCompressedTexSubImage1D (Proxy -> t -> GLenum
forall t. OneDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalOneDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
w

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

compressedTexSubImage2D :: TwoDimensionalTextureTarget t => t -> Level -> TexturePosition2D -> TextureSize2D -> CompressedPixelData a -> IO ()
compressedTexSubImage2D :: t
-> Level
-> TexturePosition2D
-> TextureSize2D
-> CompressedPixelData a
-> IO ()
compressedTexSubImage2D target :: t
target  level :: Level
level (TexturePosition2D xOff :: Level
xOff yOff :: Level
yOff) (TextureSize2D w :: Level
w h :: Level
h) cpd :: CompressedPixelData a
cpd =
   CompressedPixelData a
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b.
CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData CompressedPixelData a
cpd ((GLenum -> Level -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> Level
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> Level
-> Ptr a
-> m ()
glCompressedTexSubImage2D (Proxy -> t -> GLenum
forall t. TwoDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalTwoDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
yOff Level
w Level
h

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

-- see texImage3D, but no proxies
compressedTexSubImage3D :: ThreeDimensionalTextureTarget t => t -> Level -> TexturePosition3D -> TextureSize3D -> CompressedPixelData a -> IO ()
compressedTexSubImage3D :: t
-> Level
-> TexturePosition3D
-> TextureSize3D
-> CompressedPixelData a
-> IO ()
compressedTexSubImage3D target :: t
target level :: Level
level (TexturePosition3D xOff :: Level
xOff yOff :: Level
yOff zOff :: Level
zOff) (TextureSize3D w :: Level
w h :: Level
h d :: Level
d) cpd :: CompressedPixelData a
cpd =
   CompressedPixelData a
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b.
CompressedPixelData a -> (GLenum -> Level -> Ptr a -> b) -> b
withCompressedPixelData CompressedPixelData a
cpd ((GLenum -> Level -> Ptr a -> IO ()) -> IO ())
-> (GLenum -> Level -> Ptr a -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$
      GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> Level
-> Ptr a
-> IO ()
forall (m :: * -> *) a.
MonadIO m =>
GLenum
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> Level
-> GLenum
-> Level
-> Ptr a
-> m ()
glCompressedTexSubImage3D (Proxy -> t -> GLenum
forall t. ThreeDimensionalTextureTarget t => Proxy -> t -> GLenum
marshalThreeDimensionalTextureTarget Proxy
NoProxy t
target) Level
level Level
xOff Level
yOff Level
zOff Level
w Level
h Level
d

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

data SampleLocations =
     FlexibleSampleLocations
   | FixedSampleLocations
   deriving ( SampleLocations -> SampleLocations -> Bool
(SampleLocations -> SampleLocations -> Bool)
-> (SampleLocations -> SampleLocations -> Bool)
-> Eq SampleLocations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SampleLocations -> SampleLocations -> Bool
$c/= :: SampleLocations -> SampleLocations -> Bool
== :: SampleLocations -> SampleLocations -> Bool
$c== :: SampleLocations -> SampleLocations -> Bool
Eq, Eq SampleLocations
Eq SampleLocations =>
(SampleLocations -> SampleLocations -> Ordering)
-> (SampleLocations -> SampleLocations -> Bool)
-> (SampleLocations -> SampleLocations -> Bool)
-> (SampleLocations -> SampleLocations -> Bool)
-> (SampleLocations -> SampleLocations -> Bool)
-> (SampleLocations -> SampleLocations -> SampleLocations)
-> (SampleLocations -> SampleLocations -> SampleLocations)
-> Ord SampleLocations
SampleLocations -> SampleLocations -> Bool
SampleLocations -> SampleLocations -> Ordering
SampleLocations -> SampleLocations -> SampleLocations
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
min :: SampleLocations -> SampleLocations -> SampleLocations
$cmin :: SampleLocations -> SampleLocations -> SampleLocations
max :: SampleLocations -> SampleLocations -> SampleLocations
$cmax :: SampleLocations -> SampleLocations -> SampleLocations
>= :: SampleLocations -> SampleLocations -> Bool
$c>= :: SampleLocations -> SampleLocations -> Bool
> :: SampleLocations -> SampleLocations -> Bool
$c> :: SampleLocations -> SampleLocations -> Bool
<= :: SampleLocations -> SampleLocations -> Bool
$c<= :: SampleLocations -> SampleLocations -> Bool
< :: SampleLocations -> SampleLocations -> Bool
$c< :: SampleLocations -> SampleLocations -> Bool
compare :: SampleLocations -> SampleLocations -> Ordering
$ccompare :: SampleLocations -> SampleLocations -> Ordering
$cp1Ord :: Eq SampleLocations
Ord, Int -> SampleLocations -> ShowS
[SampleLocations] -> ShowS
SampleLocations -> String
(Int -> SampleLocations -> ShowS)
-> (SampleLocations -> String)
-> ([SampleLocations] -> ShowS)
-> Show SampleLocations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SampleLocations] -> ShowS
$cshowList :: [SampleLocations] -> ShowS
show :: SampleLocations -> String
$cshow :: SampleLocations -> String
showsPrec :: Int -> SampleLocations -> ShowS
$cshowsPrec :: Int -> SampleLocations -> ShowS
Show )

marshalSampleLocations :: SampleLocations -> GLboolean
marshalSampleLocations :: SampleLocations -> GLboolean
marshalSampleLocations = Bool -> GLboolean
forall a. Num a => Bool -> a
marshalGLboolean (Bool -> GLboolean)
-> (SampleLocations -> Bool) -> SampleLocations -> GLboolean
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SampleLocations
FixedSampleLocations SampleLocations -> SampleLocations -> Bool
forall a. Eq a => a -> a -> Bool
==)

{-
unmarshalSampleLocations :: GLboolean -> SampleLocations
unmarshalSampleLocations x =
   if unmarshalGLboolean x
      then FixedSampleLocations
      else FlexibleSampleLocations
-}

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

texImage2DMultisample :: TextureTarget2DMultisample
                      -> Proxy
                      -> Samples
                      -> PixelInternalFormat
                      -> TextureSize2D
                      -> SampleLocations
                      -> IO ()
texImage2DMultisample :: TextureTarget2DMultisample
-> Proxy
-> Samples
-> PixelInternalFormat
-> TextureSize2D
-> SampleLocations
-> IO ()
texImage2DMultisample target :: TextureTarget2DMultisample
target proxy :: Proxy
proxy (Samples s :: Level
s) int :: PixelInternalFormat
int (TextureSize2D w :: Level
w h :: Level
h) loc :: SampleLocations
loc =
   GLenum -> Level -> GLenum -> Level -> Level -> GLboolean -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum -> Level -> GLenum -> Level -> Level -> GLboolean -> m ()
glTexImage2DMultisample
      (Proxy -> TextureTarget2DMultisample -> GLenum
forall t. ParameterizedTextureTarget t => Proxy -> t -> GLenum
marshalMultisample Proxy
proxy TextureTarget2DMultisample
target) Level
s (Level -> GLenum
forall a b. (Integral a, Num b) => a -> b
fromIntegral (PixelInternalFormat -> Level
marshalPixelInternalFormat PixelInternalFormat
int))
      Level
w Level
h (SampleLocations -> GLboolean
marshalSampleLocations SampleLocations
loc)

marshalMultisample :: ParameterizedTextureTarget t => Proxy -> t -> GLenum
marshalMultisample :: Proxy -> t -> GLenum
marshalMultisample proxy :: Proxy
proxy = case Proxy
proxy of
   NoProxy -> t -> GLenum
forall t. ParameterizedTextureTarget t => t -> GLenum
marshalParameterizedTextureTarget
   Proxy -> t -> GLenum
forall t. ParameterizedTextureTarget t => t -> GLenum
marshalParameterizedTextureTargetProxy

texImage3DMultisample :: TextureTarget2DMultisampleArray
                      -> Proxy
                      -> Samples
                      -> PixelInternalFormat
                      -> TextureSize3D
                      -> SampleLocations
                      -> IO ()
texImage3DMultisample :: TextureTarget2DMultisampleArray
-> Proxy
-> Samples
-> PixelInternalFormat
-> TextureSize3D
-> SampleLocations
-> IO ()
texImage3DMultisample target :: TextureTarget2DMultisampleArray
target proxy :: Proxy
proxy (Samples s :: Level
s) int :: PixelInternalFormat
int (TextureSize3D w :: Level
w h :: Level
h d :: Level
d) loc :: SampleLocations
loc =
   GLenum
-> Level -> GLenum -> Level -> Level -> Level -> GLboolean -> IO ()
forall (m :: * -> *).
MonadIO m =>
GLenum
-> Level -> GLenum -> Level -> Level -> Level -> GLboolean -> m ()
glTexImage3DMultisample
      (Proxy -> TextureTarget2DMultisampleArray -> GLenum
forall t. ParameterizedTextureTarget t => Proxy -> t -> GLenum
marshalMultisample Proxy
proxy TextureTarget2DMultisampleArray
target) Level
s (Level -> GLenum
forall a b. (Integral a, Num b) => a -> b
fromIntegral (PixelInternalFormat -> Level
marshalPixelInternalFormat PixelInternalFormat
int))
      Level
w Level
h Level
d (SampleLocations -> GLboolean
marshalSampleLocations SampleLocations
loc)

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

maxTextureSize :: GettableStateVar GLsizei
maxTextureSize :: GettableStateVar Level
maxTextureSize = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxTextureSize

maxCubeMapTextureSize :: GettableStateVar GLsizei
maxCubeMapTextureSize :: GettableStateVar Level
maxCubeMapTextureSize = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxCubeMapTextureSize

maxRectangleTextureSize :: GettableStateVar GLsizei
maxRectangleTextureSize :: GettableStateVar Level
maxRectangleTextureSize = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxRectangleTextureSize

max3DTextureSize :: GettableStateVar GLsizei
max3DTextureSize :: GettableStateVar Level
max3DTextureSize = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMax3DTextureSize

maxArrayTextureLayers :: GettableStateVar GLsizei
maxArrayTextureLayers :: GettableStateVar Level
maxArrayTextureLayers = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxArrayTextureLayers

maxSampleMaskWords :: GettableStateVar GLsizei
maxSampleMaskWords :: GettableStateVar Level
maxSampleMaskWords = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxSampleMaskWords

maxColorTextureSamples :: GettableStateVar GLsizei
maxColorTextureSamples :: GettableStateVar Level
maxColorTextureSamples = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxColorTextureSamples

maxDepthTextureSamples :: GettableStateVar GLsizei
maxDepthTextureSamples :: GettableStateVar Level
maxDepthTextureSamples = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxDepthTextureSamples

maxIntegerSamples :: GettableStateVar GLsizei
maxIntegerSamples :: GettableStateVar Level
maxIntegerSamples = PName1I -> GettableStateVar Level
maxTextureSizeWith PName1I
GetMaxIntegerSamples

maxTextureSizeWith :: PName1I -> GettableStateVar GLsizei
maxTextureSizeWith :: PName1I -> GettableStateVar Level
maxTextureSizeWith = GettableStateVar Level -> GettableStateVar Level
forall a. IO a -> IO a
makeGettableStateVar (GettableStateVar Level -> GettableStateVar Level)
-> (PName1I -> GettableStateVar Level)
-> PName1I
-> GettableStateVar Level
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Level -> Level) -> PName1I -> GettableStateVar Level
forall p a. GetPName1I p => (Level -> a) -> p -> IO a
getInteger1 Level -> Level
forall a b. (Integral a, Num b) => a -> b
fromIntegral