    {-# OPTIONS_HADDOCK hide #-}
    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GL.PrimitiveModeInternal
    -- Copyright   :  (c) Sven Panne 2002-2019
    -- License     :  BSD3
    --
    -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
    -- Stability   :  stable
    -- Portability :  portable
    --
    -- This is a purely internal module for (un-)marshaling PrimitiveMode.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GL.PrimitiveModeInternal (
       marshalPrimitiveMode, unmarshalPrimitiveMode
    ) where

    import Graphics.GL
    import Graphics.Rendering.OpenGL.GL.PrimitiveMode

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

    marshalPrimitiveMode :: PrimitiveMode -> GLenum
    marshalPrimitiveMode :: PrimitiveMode -> GLenum
    marshalPrimitiveMode PrimitiveMode
    x = case PrimitiveMode
    x of
       PrimitiveMode
    Points -> GLenum
    GL_POINTS
       PrimitiveMode
    Lines -> GLenum
    GL_LINES
       PrimitiveMode
    LineLoop -> GLenum
    GL_LINE_LOOP
       PrimitiveMode
    LineStrip -> GLenum
    GL_LINE_STRIP
       PrimitiveMode
    Triangles -> GLenum
    GL_TRIANGLES
       PrimitiveMode
    TriangleStrip -> GLenum
    GL_TRIANGLE_STRIP
       PrimitiveMode
    TriangleFan -> GLenum
    GL_TRIANGLE_FAN
       PrimitiveMode
    Quads -> GLenum
    GL_QUADS
       PrimitiveMode
    QuadStrip -> GLenum
    GL_QUAD_STRIP
       PrimitiveMode
    Polygon -> GLenum
    GL_POLYGON
       PrimitiveMode
    Patches -> GLenum
    GL_PATCHES

    unmarshalPrimitiveMode :: GLenum -> PrimitiveMode
    unmarshalPrimitiveMode :: GLenum -> PrimitiveMode
    unmarshalPrimitiveMode GLenum
    x
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_POINTS = PrimitiveMode
    Points
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_LINES = PrimitiveMode
    Lines
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_LINE_LOOP = PrimitiveMode
    LineLoop
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_LINE_STRIP = PrimitiveMode
    LineStrip
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_TRIANGLES = PrimitiveMode
    Triangles
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_TRIANGLE_STRIP = PrimitiveMode
    TriangleStrip
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_TRIANGLE_FAN = PrimitiveMode
    TriangleFan
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_QUADS = PrimitiveMode
    Quads
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_QUAD_STRIP = PrimitiveMode
    QuadStrip
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_POLYGON = PrimitiveMode
    Polygon
       | GLenum
    x GLenum -> GLenum -> Bool
    forall a. Eq a => a -> a -> Bool
    == GLenum
    GL_PATCHES = PrimitiveMode
    Patches
       | Bool
    otherwise = [Char] -> PrimitiveMode
    forall a. HasCallStack => [Char] -> a
    error ([Char]
    "unmarshalPrimitiveMode: illegal value " [Char] -> [Char] -> [Char]
    forall a. [a] -> [a] -> [a]
    ++ GLenum -> [Char]
    forall a. Show a => a -> [Char]
    show GLenum
    x)