{-# OPTIONS_HADDOCK hide #-}
module Graphics.Rendering.OpenGL.GL.ComparisonFunction (
ComparisonFunction(..), marshalComparisonFunction,
unmarshalComparisonFunction
) where
import Graphics.GL
data ComparisonFunction =
Never
| Less
| Equal
| Lequal
| Greater
| Notequal
| Gequal
| Always
deriving ( Eq, Ord, Show )
marshalComparisonFunction :: ComparisonFunction -> GLenum
marshalComparisonFunction x = case x of
Never -> GL_NEVER
Less -> GL_LESS
Equal -> GL_EQUAL
Lequal -> GL_LEQUAL
Greater -> GL_GREATER
Notequal -> GL_NOTEQUAL
Gequal -> GL_GEQUAL
Always -> GL_ALWAYS
unmarshalComparisonFunction :: GLenum -> ComparisonFunction
unmarshalComparisonFunction x
| x == GL_NEVER = Never
| x == GL_LESS = Less
| x == GL_EQUAL = Equal
| x == GL_LEQUAL = Lequal
| x == GL_GREATER = Greater
| x == GL_NOTEQUAL = Notequal
| x == GL_GEQUAL = Gequal
| x == GL_ALWAYS = Always
| otherwise = error ("unmarshalComparisonFunction: illegal value " ++ show x)