    --------------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.OpenGL.GLU.Quadrics
    -- Copyright   :  (c) Sven Panne 2002-2019
    -- License     :  BSD3
    --
    -- Maintainer  :  Sven Panne <svenpanne@gmail.com>
    -- Stability   :  stable
    -- Portability :  portable
    --
    -- This module corresponds to chapter 6 (Quadrics) of the GLU specs.
    --
    --------------------------------------------------------------------------------

    module Graphics.Rendering.OpenGL.GLU.Quadrics (
       QuadricNormal, QuadricTexture(..), QuadricOrientation(..),
       QuadricDrawStyle(..), QuadricStyle(..),
       Radius, Height, Angle, Slices, Stacks, Loops, QuadricPrimitive(..),
       renderQuadric
    ) where

    import Control.Monad ( unless )
    import Foreign.Ptr ( Ptr, nullPtr, freeHaskellFunPtr )
    import Graphics.GLU
    import Graphics.Rendering.OpenGL.GL.Colors ( ShadingModel(Smooth,Flat) )
    import Graphics.Rendering.OpenGL.GL.Exception ( bracket )
    import Graphics.Rendering.OpenGL.GL.GLboolean ( marshalGLboolean )
    import Graphics.Rendering.OpenGL.GLU.ErrorsInternal (
       recordErrorCode, recordOutOfMemory )
    import Graphics.GL

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

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

    marshalQuadricDrawStyle :: QuadricDrawStyle -> GLenum
    marshalQuadricDrawStyle :: QuadricDrawStyle -> GLenum
    marshalQuadricDrawStyle QuadricDrawStyle
    x = case QuadricDrawStyle
    x of
       QuadricDrawStyle
    PointStyle -> GLenum
    GLU_POINT
       QuadricDrawStyle
    LineStyle -> GLenum
    GLU_LINE
       QuadricDrawStyle
    FillStyle -> GLenum
    GLU_FILL
       QuadricDrawStyle
    SilhouetteStyle -> GLenum
    GLU_SILHOUETTE

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

    type QuadricNormal = Maybe ShadingModel

    marshalQuadricNormal :: QuadricNormal -> GLenum
    marshalQuadricNormal :: QuadricNormal -> GLenum
    marshalQuadricNormal (Just ShadingModel
    Smooth) = GLenum
    GLU_SMOOTH
    marshalQuadricNormal (Just ShadingModel
    Flat  ) = GLenum
    GLU_FLAT
    marshalQuadricNormal QuadricNormal
    Nothing       = GLenum
    GLU_NONE

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

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

    marshalQuadricOrientation :: QuadricOrientation -> GLenum
    marshalQuadricOrientation :: QuadricOrientation -> GLenum
    marshalQuadricOrientation QuadricOrientation
    x = case QuadricOrientation
    x of
       QuadricOrientation
    Outside -> GLenum
    GLU_OUTSIDE
       QuadricOrientation
    Inside -> GLenum
    GLU_INSIDE

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

    data QuadricTexture
       = NoTextureCoordinates
       | GenerateTextureCoordinates
       deriving ( QuadricTexture -> QuadricTexture -> Bool
    (QuadricTexture -> QuadricTexture -> Bool)
    -> (QuadricTexture -> QuadricTexture -> Bool) -> Eq QuadricTexture
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: QuadricTexture -> QuadricTexture -> Bool
    == :: QuadricTexture -> QuadricTexture -> Bool
    $c/= :: QuadricTexture -> QuadricTexture -> Bool
    /= :: QuadricTexture -> QuadricTexture -> Bool
    Eq,Eq QuadricTexture
    Eq QuadricTexture =>
    (QuadricTexture -> QuadricTexture -> Ordering)
    -> (QuadricTexture -> QuadricTexture -> Bool)
    -> (QuadricTexture -> QuadricTexture -> Bool)
    -> (QuadricTexture -> QuadricTexture -> Bool)
    -> (QuadricTexture -> QuadricTexture -> Bool)
    -> (QuadricTexture -> QuadricTexture -> QuadricTexture)
    -> (QuadricTexture -> QuadricTexture -> QuadricTexture)
    -> Ord QuadricTexture
    QuadricTexture -> QuadricTexture -> Bool
    QuadricTexture -> QuadricTexture -> Ordering
    QuadricTexture -> QuadricTexture -> QuadricTexture
    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 :: QuadricTexture -> QuadricTexture -> Ordering
    compare :: QuadricTexture -> QuadricTexture -> Ordering
    $c< :: QuadricTexture -> QuadricTexture -> Bool
    < :: QuadricTexture -> QuadricTexture -> Bool
    $c<= :: QuadricTexture -> QuadricTexture -> Bool
    <= :: QuadricTexture -> QuadricTexture -> Bool
    $c> :: QuadricTexture -> QuadricTexture -> Bool
    > :: QuadricTexture -> QuadricTexture -> Bool
    $c>= :: QuadricTexture -> QuadricTexture -> Bool
    >= :: QuadricTexture -> QuadricTexture -> Bool
    $cmax :: QuadricTexture -> QuadricTexture -> QuadricTexture
    max :: QuadricTexture -> QuadricTexture -> QuadricTexture
    $cmin :: QuadricTexture -> QuadricTexture -> QuadricTexture
    min :: QuadricTexture -> QuadricTexture -> QuadricTexture
    Ord )

    marshalQuadricTexture :: QuadricTexture -> GLboolean
    marshalQuadricTexture :: QuadricTexture -> GLboolean
    marshalQuadricTexture QuadricTexture
    NoTextureCoordinates       = Bool -> GLboolean
    forall a. Num a => Bool -> a
    marshalGLboolean Bool
    False
    marshalQuadricTexture QuadricTexture
    GenerateTextureCoordinates = Bool -> GLboolean
    forall a. Num a => Bool -> a
    marshalGLboolean Bool
    True

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

    data QuadricStyle
       = QuadricStyle QuadricNormal
                      QuadricTexture
                      QuadricOrientation
                      QuadricDrawStyle
       deriving ( QuadricStyle -> QuadricStyle -> Bool
    (QuadricStyle -> QuadricStyle -> Bool)
    -> (QuadricStyle -> QuadricStyle -> Bool) -> Eq QuadricStyle
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: QuadricStyle -> QuadricStyle -> Bool
    == :: QuadricStyle -> QuadricStyle -> Bool
    $c/= :: QuadricStyle -> QuadricStyle -> Bool
    /= :: QuadricStyle -> QuadricStyle -> Bool
    Eq,Eq QuadricStyle
    Eq QuadricStyle =>
    (QuadricStyle -> QuadricStyle -> Ordering)
    -> (QuadricStyle -> QuadricStyle -> Bool)
    -> (QuadricStyle -> QuadricStyle -> Bool)
    -> (QuadricStyle -> QuadricStyle -> Bool)
    -> (QuadricStyle -> QuadricStyle -> Bool)
    -> (QuadricStyle -> QuadricStyle -> QuadricStyle)
    -> (QuadricStyle -> QuadricStyle -> QuadricStyle)
    -> Ord QuadricStyle
    QuadricStyle -> QuadricStyle -> Bool
    QuadricStyle -> QuadricStyle -> Ordering
    QuadricStyle -> QuadricStyle -> QuadricStyle
    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 :: QuadricStyle -> QuadricStyle -> Ordering
    compare :: QuadricStyle -> QuadricStyle -> Ordering
    $c< :: QuadricStyle -> QuadricStyle -> Bool
    < :: QuadricStyle -> QuadricStyle -> Bool
    $c<= :: QuadricStyle -> QuadricStyle -> Bool
    <= :: QuadricStyle -> QuadricStyle -> Bool
    $c> :: QuadricStyle -> QuadricStyle -> Bool
    > :: QuadricStyle -> QuadricStyle -> Bool
    $c>= :: QuadricStyle -> QuadricStyle -> Bool
    >= :: QuadricStyle -> QuadricStyle -> Bool
    $cmax :: QuadricStyle -> QuadricStyle -> QuadricStyle
    max :: QuadricStyle -> QuadricStyle -> QuadricStyle
    $cmin :: QuadricStyle -> QuadricStyle -> QuadricStyle
    min :: QuadricStyle -> QuadricStyle -> QuadricStyle
    Ord )

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

    type Radius = GLdouble
    type Height = GLdouble
    type Angle  = GLdouble
    type Slices = GLint
    type Stacks = GLint
    type Loops  = GLint

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

    data QuadricPrimitive
       = Sphere Radius Slices Stacks
       | Cylinder Radius Radius Height Slices Stacks
       | Disk Radius Radius Slices Loops
       | PartialDisk Radius Radius Slices Loops Angle Angle
       deriving ( QuadricPrimitive -> QuadricPrimitive -> Bool
    (QuadricPrimitive -> QuadricPrimitive -> Bool)
    -> (QuadricPrimitive -> QuadricPrimitive -> Bool)
    -> Eq QuadricPrimitive
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: QuadricPrimitive -> QuadricPrimitive -> Bool
    == :: QuadricPrimitive -> QuadricPrimitive -> Bool
    $c/= :: QuadricPrimitive -> QuadricPrimitive -> Bool
    /= :: QuadricPrimitive -> QuadricPrimitive -> Bool
    Eq, Eq QuadricPrimitive
    Eq QuadricPrimitive =>
    (QuadricPrimitive -> QuadricPrimitive -> Ordering)
    -> (QuadricPrimitive -> QuadricPrimitive -> Bool)
    -> (QuadricPrimitive -> QuadricPrimitive -> Bool)
    -> (QuadricPrimitive -> QuadricPrimitive -> Bool)
    -> (QuadricPrimitive -> QuadricPrimitive -> Bool)
    -> (QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive)
    -> (QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive)
    -> Ord QuadricPrimitive
    QuadricPrimitive -> QuadricPrimitive -> Bool
    QuadricPrimitive -> QuadricPrimitive -> Ordering
    QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive
    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 :: QuadricPrimitive -> QuadricPrimitive -> Ordering
    compare :: QuadricPrimitive -> QuadricPrimitive -> Ordering
    $c< :: QuadricPrimitive -> QuadricPrimitive -> Bool
    < :: QuadricPrimitive -> QuadricPrimitive -> Bool
    $c<= :: QuadricPrimitive -> QuadricPrimitive -> Bool
    <= :: QuadricPrimitive -> QuadricPrimitive -> Bool
    $c> :: QuadricPrimitive -> QuadricPrimitive -> Bool
    > :: QuadricPrimitive -> QuadricPrimitive -> Bool
    $c>= :: QuadricPrimitive -> QuadricPrimitive -> Bool
    >= :: QuadricPrimitive -> QuadricPrimitive -> Bool
    $cmax :: QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive
    max :: QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive
    $cmin :: QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive
    min :: QuadricPrimitive -> QuadricPrimitive -> QuadricPrimitive
    Ord )

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

    renderQuadric :: QuadricStyle -> QuadricPrimitive -> IO ()
    renderQuadric :: QuadricStyle -> QuadricPrimitive -> IO ()
    renderQuadric QuadricStyle
    style QuadricPrimitive
    prim = do
       IO () -> (QuadricObj -> IO ()) -> IO ()
    forall a. IO a -> (QuadricObj -> IO a) -> IO a
    withQuadricObj IO ()
    recordOutOfMemory ((QuadricObj -> IO ()) -> IO ()) -> (QuadricObj -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \QuadricObj
    quadricObj ->
          QuadricObj -> QuadricCallback -> IO () -> IO ()
    forall a. QuadricObj -> QuadricCallback -> IO a -> IO a
    withErrorCallback QuadricObj
    quadricObj QuadricCallback
    recordErrorCode (IO () -> IO ()) -> IO () -> IO ()
    forall a b. (a -> b) -> a -> b
    $ do
             QuadricObj -> QuadricStyle -> IO ()
    setStyle QuadricObj
    quadricObj QuadricStyle
    style
             QuadricObj -> QuadricPrimitive -> IO ()
    renderPrimitive QuadricObj
    quadricObj QuadricPrimitive
    prim

    withQuadricObj :: IO a -> (QuadricObj -> IO a) -> IO a
    withQuadricObj :: forall a. IO a -> (QuadricObj -> IO a) -> IO a
    withQuadricObj IO a
    failure QuadricObj -> IO a
    success =
       IO QuadricObj
    -> (QuadricObj -> IO ()) -> (QuadricObj -> IO a) -> IO a
    forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
    bracket IO QuadricObj
    forall (m :: * -> *). MonadIO m => m QuadricObj
    gluNewQuadric QuadricObj -> IO ()
    safeDeleteQuadric
               (\QuadricObj
    quadricObj -> if QuadricObj -> Bool
    isNullQuadricObj QuadricObj
    quadricObj
                                  then IO a
    failure
                                  else QuadricObj -> IO a
    success QuadricObj
    quadricObj)

    safeDeleteQuadric :: QuadricObj -> IO ()
    safeDeleteQuadric :: QuadricObj -> IO ()
    safeDeleteQuadric QuadricObj
    quadricObj =
       Bool -> IO () -> IO ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    unless (QuadricObj -> Bool
    isNullQuadricObj QuadricObj
    quadricObj) (IO () -> IO ()) -> IO () -> IO ()
    forall a b. (a -> b) -> a -> b
    $ QuadricObj -> IO ()
    forall (m :: * -> *). MonadIO m => QuadricObj -> m ()
    gluDeleteQuadric QuadricObj
    quadricObj

    withErrorCallback :: QuadricObj -> QuadricCallback -> IO a -> IO a
    withErrorCallback :: forall a. QuadricObj -> QuadricCallback -> IO a -> IO a
    withErrorCallback QuadricObj
    quadricObj QuadricCallback
    callback IO a
    action =
       IO (FunPtr QuadricCallback)
    -> (FunPtr QuadricCallback -> IO ())
    -> (FunPtr QuadricCallback -> IO a)
    -> IO a
    forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
    bracket (QuadricCallback -> IO (FunPtr QuadricCallback)
    makeQuadricCallback QuadricCallback
    callback) FunPtr QuadricCallback -> IO ()
    forall a. FunPtr a -> IO ()
    freeHaskellFunPtr ((FunPtr QuadricCallback -> IO a) -> IO a)
    -> (FunPtr QuadricCallback -> IO a) -> IO a
    forall a b. (a -> b) -> a -> b
    $ \FunPtr QuadricCallback
    callbackPtr -> do
          QuadricObj -> GLenum -> FunPtr QuadricCallback -> IO ()
    forall (m :: * -> *) a.
    MonadIO m =>
    QuadricObj -> GLenum -> FunPtr a -> m ()
    gluQuadricCallback QuadricObj
    quadricObj GLenum
    GLU_ERROR FunPtr QuadricCallback
    callbackPtr
          IO a
    action

    setStyle :: QuadricObj -> QuadricStyle -> IO ()
    setStyle :: QuadricObj -> QuadricStyle -> IO ()
    setStyle QuadricObj
    quadricObj (QuadricStyle QuadricNormal
    n QuadricTexture
    t QuadricOrientation
    o QuadricDrawStyle
    d) = do
       QuadricObj -> QuadricCallback
    forall (m :: * -> *). MonadIO m => QuadricObj -> GLenum -> m ()
    gluQuadricNormals     QuadricObj
    quadricObj (QuadricNormal -> GLenum
    marshalQuadricNormal      QuadricNormal
    n)
       QuadricObj -> GLboolean -> IO ()
    forall (m :: * -> *). MonadIO m => QuadricObj -> GLboolean -> m ()
    gluQuadricTexture     QuadricObj
    quadricObj (QuadricTexture -> GLboolean
    marshalQuadricTexture     QuadricTexture
    t)
       QuadricObj -> QuadricCallback
    forall (m :: * -> *). MonadIO m => QuadricObj -> GLenum -> m ()
    gluQuadricOrientation QuadricObj
    quadricObj (QuadricOrientation -> GLenum
    marshalQuadricOrientation QuadricOrientation
    o)
       QuadricObj -> QuadricCallback
    forall (m :: * -> *). MonadIO m => QuadricObj -> GLenum -> m ()
    gluQuadricDrawStyle   QuadricObj
    quadricObj (QuadricDrawStyle -> GLenum
    marshalQuadricDrawStyle   QuadricDrawStyle
    d)

    renderPrimitive :: QuadricObj -> QuadricPrimitive -> IO ()
    renderPrimitive :: QuadricObj -> QuadricPrimitive -> IO ()
    renderPrimitive QuadricObj
    quadricObj (Sphere Radius
    r Slices
    s Slices
    n) =
       QuadricObj -> Radius -> Slices -> Slices -> IO ()
    forall (m :: * -> *).
    MonadIO m =>
    QuadricObj -> Radius -> Slices -> Slices -> m ()
    gluSphere QuadricObj
    quadricObj Radius
    r Slices
    s Slices
    n
    renderPrimitive QuadricObj
    quadricObj (Cylinder Radius
    b Radius
    t Radius
    h Slices
    s Slices
    n) =
       QuadricObj
    -> Radius -> Radius -> Radius -> Slices -> Slices -> IO ()
    forall (m :: * -> *).
    MonadIO m =>
    QuadricObj
    -> Radius -> Radius -> Radius -> Slices -> Slices -> m ()
    gluCylinder QuadricObj
    quadricObj Radius
    b Radius
    t Radius
    h Slices
    s Slices
    n
    renderPrimitive QuadricObj
    quadricObj (Disk Radius
    i Radius
    o Slices
    s Slices
    l) =
       QuadricObj -> Radius -> Radius -> Slices -> Slices -> IO ()
    forall (m :: * -> *).
    MonadIO m =>
    QuadricObj -> Radius -> Radius -> Slices -> Slices -> m ()
    gluDisk QuadricObj
    quadricObj Radius
    i Radius
    o Slices
    s Slices
    l
    renderPrimitive QuadricObj
    quadricObj (PartialDisk Radius
    i Radius
    o Slices
    s Slices
    l Radius
    a Radius
    w) =
       QuadricObj
    -> Radius
    -> Radius
    -> Slices
    -> Slices
    -> Radius
    -> Radius
    -> IO ()
    forall (m :: * -> *).
    MonadIO m =>
    QuadricObj
    -> Radius -> Radius -> Slices -> Slices -> Radius -> Radius -> m ()
    gluPartialDisk QuadricObj
    quadricObj Radius
    i Radius
    o Slices
    s Slices
    l Radius
    a Radius
    w

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

    type QuadricObj = Ptr GLUquadric

    isNullQuadricObj :: QuadricObj -> Bool
    isNullQuadricObj :: QuadricObj -> Bool
    isNullQuadricObj = (QuadricObj
    forall a. Ptr a
    nullPtr QuadricObj -> QuadricObj -> Bool
    forall a. Eq a => a -> a -> Bool
    ==)