{-# OPTIONS_HADDOCK hide #-}
module Graphics.Rendering.OpenGL.GL.DataType (
DataType(..), marshalDataType, unmarshalDataType,
DataRepresentation(..), unmarshalDataRepresentation
) where
import Graphics.GL
data DataType =
UnsignedByte
| Byte
| UnsignedShort
| Short
| UnsignedInt
| Int
| HalfFloat
| Float
| UnsignedByte332
| UnsignedByte233Rev
| UnsignedShort565
| UnsignedShort565Rev
| UnsignedShort4444
| UnsignedShort4444Rev
| UnsignedShort5551
| UnsignedShort1555Rev
| UnsignedInt8888
| UnsignedInt8888Rev
| UnsignedInt1010102
| UnsignedInt2101010Rev
| UnsignedInt248
| UnsignedInt10f11f11fRev
| UnsignedInt5999Rev
| Float32UnsignedInt248Rev
| Bitmap
| UnsignedShort88
| UnsignedShort88Rev
| Double
| TwoBytes
| ThreeBytes
| FourBytes
deriving ( DataType -> DataType -> Bool
(DataType -> DataType -> Bool)
-> (DataType -> DataType -> Bool) -> Eq DataType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DataType -> DataType -> Bool
== :: DataType -> DataType -> Bool
$c/= :: DataType -> DataType -> Bool
/= :: DataType -> DataType -> Bool
Eq, Eq DataType
Eq DataType =>
(DataType -> DataType -> Ordering)
-> (DataType -> DataType -> Bool)
-> (DataType -> DataType -> Bool)
-> (DataType -> DataType -> Bool)
-> (DataType -> DataType -> Bool)
-> (DataType -> DataType -> DataType)
-> (DataType -> DataType -> DataType)
-> Ord DataType
DataType -> DataType -> Bool
DataType -> DataType -> Ordering
DataType -> DataType -> DataType
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 :: DataType -> DataType -> Ordering
compare :: DataType -> DataType -> Ordering
$c< :: DataType -> DataType -> Bool
< :: DataType -> DataType -> Bool
$c<= :: DataType -> DataType -> Bool
<= :: DataType -> DataType -> Bool
$c> :: DataType -> DataType -> Bool
> :: DataType -> DataType -> Bool
$c>= :: DataType -> DataType -> Bool
>= :: DataType -> DataType -> Bool
$cmax :: DataType -> DataType -> DataType
max :: DataType -> DataType -> DataType
$cmin :: DataType -> DataType -> DataType
min :: DataType -> DataType -> DataType
Ord, Int -> DataType -> ShowS
[DataType] -> ShowS
DataType -> String
(Int -> DataType -> ShowS)
-> (DataType -> String) -> ([DataType] -> ShowS) -> Show DataType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DataType -> ShowS
showsPrec :: Int -> DataType -> ShowS
$cshow :: DataType -> String
show :: DataType -> String
$cshowList :: [DataType] -> ShowS
showList :: [DataType] -> ShowS
Show )
marshalDataType :: DataType -> GLenum
marshalDataType :: DataType -> GLenum
marshalDataType DataType
x = case DataType
x of
DataType
UnsignedByte -> GLenum
GL_UNSIGNED_BYTE
DataType
Byte -> GLenum
GL_BYTE
DataType
UnsignedShort -> GLenum
GL_UNSIGNED_SHORT
DataType
Short -> GLenum
GL_SHORT
DataType
UnsignedInt -> GLenum
GL_UNSIGNED_INT
DataType
Int -> GLenum
GL_INT
DataType
HalfFloat -> GLenum
GL_HALF_FLOAT
DataType
Float -> GLenum
GL_FLOAT
DataType
UnsignedByte332 -> GLenum
GL_UNSIGNED_BYTE_3_3_2
DataType
UnsignedByte233Rev -> GLenum
GL_UNSIGNED_BYTE_2_3_3_REV
DataType
UnsignedShort565 -> GLenum
GL_UNSIGNED_SHORT_5_6_5
DataType
UnsignedShort565Rev -> GLenum
GL_UNSIGNED_SHORT_5_6_5_REV
DataType
UnsignedShort4444 -> GLenum
GL_UNSIGNED_SHORT_4_4_4_4
DataType
UnsignedShort4444Rev -> GLenum
GL_UNSIGNED_SHORT_4_4_4_4_REV
DataType
UnsignedShort5551 -> GLenum
GL_UNSIGNED_SHORT_5_5_5_1
DataType
UnsignedShort1555Rev -> GLenum
GL_UNSIGNED_SHORT_1_5_5_5_REV
DataType
UnsignedInt8888 -> GLenum
GL_UNSIGNED_INT_8_8_8_8
DataType
UnsignedInt8888Rev -> GLenum
GL_UNSIGNED_INT_8_8_8_8_REV
DataType
UnsignedInt1010102 -> GLenum
GL_UNSIGNED_INT_10_10_10_2
DataType
UnsignedInt2101010Rev -> GLenum
GL_UNSIGNED_INT_2_10_10_10_REV
DataType
UnsignedInt248 -> GLenum
GL_UNSIGNED_INT_24_8
DataType
UnsignedInt10f11f11fRev -> GLenum
GL_UNSIGNED_INT_10F_11F_11F_REV
DataType
UnsignedInt5999Rev -> GLenum
GL_UNSIGNED_INT_5_9_9_9_REV
DataType
Float32UnsignedInt248Rev -> GLenum
GL_FLOAT_32_UNSIGNED_INT_24_8_REV
DataType
Bitmap -> GLenum
GL_BITMAP
DataType
UnsignedShort88 -> GLenum
GL_UNSIGNED_SHORT_8_8_APPLE
DataType
UnsignedShort88Rev -> GLenum
GL_UNSIGNED_SHORT_8_8_REV_APPLE
DataType
Double -> GLenum
GL_DOUBLE
DataType
TwoBytes -> GLenum
GL_2_BYTES
DataType
ThreeBytes -> GLenum
GL_3_BYTES
DataType
FourBytes -> GLenum
GL_4_BYTES
unmarshalDataType :: GLenum -> DataType
unmarshalDataType :: GLenum -> DataType
unmarshalDataType GLenum
x
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_BYTE = DataType
UnsignedByte
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_BYTE = DataType
Byte
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT = DataType
UnsignedShort
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_SHORT = DataType
Short
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT = DataType
UnsignedInt
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_INT = DataType
Int
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_HALF_FLOAT = DataType
HalfFloat
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_FLOAT = DataType
Float
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_BYTE_3_3_2 = DataType
UnsignedByte332
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_BYTE_2_3_3_REV = DataType
UnsignedByte233Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_5_6_5 = DataType
UnsignedShort565
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_5_6_5_REV = DataType
UnsignedShort565Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_4_4_4_4 = DataType
UnsignedShort4444
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_4_4_4_4_REV = DataType
UnsignedShort4444Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_5_5_5_1 = DataType
UnsignedShort5551
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_1_5_5_5_REV = DataType
UnsignedShort1555Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_8_8_8_8 = DataType
UnsignedInt8888
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_8_8_8_8_REV = DataType
UnsignedInt8888Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_10_10_10_2 = DataType
UnsignedInt1010102
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_2_10_10_10_REV = DataType
UnsignedInt2101010Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_24_8 = DataType
UnsignedInt248
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_10F_11F_11F_REV = DataType
UnsignedInt10f11f11fRev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT_5_9_9_9_REV = DataType
UnsignedInt5999Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_FLOAT_32_UNSIGNED_INT_24_8_REV = DataType
Float32UnsignedInt248Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_BITMAP = DataType
Bitmap
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_8_8_APPLE = DataType
UnsignedShort88
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_SHORT_8_8_REV_APPLE = DataType
UnsignedShort88Rev
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_DOUBLE = DataType
Double
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_2_BYTES = DataType
TwoBytes
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_3_BYTES = DataType
ThreeBytes
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_4_BYTES = DataType
FourBytes
| Bool
otherwise = String -> DataType
forall a. HasCallStack => String -> a
error (String
"unmarshalDataType: illegal value " String -> ShowS
forall a. [a] -> [a] -> [a]
++ GLenum -> String
forall a. Show a => a -> String
show GLenum
x)
data DataRepresentation
= SignedNormalizedRepresentation
| UnsignedNormalizedRepresentation
| FloatRepresentation
| IntRepresentation
| UnsignedIntRepresentation
deriving ( DataRepresentation -> DataRepresentation -> Bool
(DataRepresentation -> DataRepresentation -> Bool)
-> (DataRepresentation -> DataRepresentation -> Bool)
-> Eq DataRepresentation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DataRepresentation -> DataRepresentation -> Bool
== :: DataRepresentation -> DataRepresentation -> Bool
$c/= :: DataRepresentation -> DataRepresentation -> Bool
/= :: DataRepresentation -> DataRepresentation -> Bool
Eq, Eq DataRepresentation
Eq DataRepresentation =>
(DataRepresentation -> DataRepresentation -> Ordering)
-> (DataRepresentation -> DataRepresentation -> Bool)
-> (DataRepresentation -> DataRepresentation -> Bool)
-> (DataRepresentation -> DataRepresentation -> Bool)
-> (DataRepresentation -> DataRepresentation -> Bool)
-> (DataRepresentation -> DataRepresentation -> DataRepresentation)
-> (DataRepresentation -> DataRepresentation -> DataRepresentation)
-> Ord DataRepresentation
DataRepresentation -> DataRepresentation -> Bool
DataRepresentation -> DataRepresentation -> Ordering
DataRepresentation -> DataRepresentation -> DataRepresentation
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 :: DataRepresentation -> DataRepresentation -> Ordering
compare :: DataRepresentation -> DataRepresentation -> Ordering
$c< :: DataRepresentation -> DataRepresentation -> Bool
< :: DataRepresentation -> DataRepresentation -> Bool
$c<= :: DataRepresentation -> DataRepresentation -> Bool
<= :: DataRepresentation -> DataRepresentation -> Bool
$c> :: DataRepresentation -> DataRepresentation -> Bool
> :: DataRepresentation -> DataRepresentation -> Bool
$c>= :: DataRepresentation -> DataRepresentation -> Bool
>= :: DataRepresentation -> DataRepresentation -> Bool
$cmax :: DataRepresentation -> DataRepresentation -> DataRepresentation
max :: DataRepresentation -> DataRepresentation -> DataRepresentation
$cmin :: DataRepresentation -> DataRepresentation -> DataRepresentation
min :: DataRepresentation -> DataRepresentation -> DataRepresentation
Ord, Int -> DataRepresentation -> ShowS
[DataRepresentation] -> ShowS
DataRepresentation -> String
(Int -> DataRepresentation -> ShowS)
-> (DataRepresentation -> String)
-> ([DataRepresentation] -> ShowS)
-> Show DataRepresentation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DataRepresentation -> ShowS
showsPrec :: Int -> DataRepresentation -> ShowS
$cshow :: DataRepresentation -> String
show :: DataRepresentation -> String
$cshowList :: [DataRepresentation] -> ShowS
showList :: [DataRepresentation] -> ShowS
Show )
unmarshalDataRepresentation :: GLenum -> Maybe DataRepresentation
unmarshalDataRepresentation :: GLenum -> Maybe DataRepresentation
unmarshalDataRepresentation GLenum
x
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_SIGNED_NORMALIZED = DataRepresentation -> Maybe DataRepresentation
forall a. a -> Maybe a
Just DataRepresentation
SignedNormalizedRepresentation
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_NORMALIZED = DataRepresentation -> Maybe DataRepresentation
forall a. a -> Maybe a
Just DataRepresentation
UnsignedNormalizedRepresentation
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_FLOAT = DataRepresentation -> Maybe DataRepresentation
forall a. a -> Maybe a
Just DataRepresentation
FloatRepresentation
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_INT = DataRepresentation -> Maybe DataRepresentation
forall a. a -> Maybe a
Just DataRepresentation
IntRepresentation
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_UNSIGNED_INT = DataRepresentation -> Maybe DataRepresentation
forall a. a -> Maybe a
Just DataRepresentation
UnsignedIntRepresentation
| GLenum
x GLenum -> GLenum -> Bool
forall a. Eq a => a -> a -> Bool
== GLenum
GL_NONE = Maybe DataRepresentation
forall a. Maybe a
Nothing
| Bool
otherwise = String -> Maybe DataRepresentation
forall a. HasCallStack => String -> a
error (String -> Maybe DataRepresentation)
-> String -> Maybe DataRepresentation
forall a b. (a -> b) -> a -> b
$ String
"unmarshalDataRepresentation: illegal value " String -> ShowS
forall a. [a] -> [a] -> [a]
++ GLenum -> String
forall a. Show a => a -> String
show GLenum
x