title: Minimal Haskell OpenGL Example causes OpenGL Error
body: <p>I was toying with an OpenGL example and ran into a problem.  I minimized it to one of the <a href="https://wiki.haskell.org/OpenGLTutorial1" rel="nofollow noreferrer">mainstream Haskell/OpenGL examples</a>.  This is with Windows 10, Haskell Platform (32-bit 8.0.2-a.  Almost positive it's the -a variant).</p>
  
  <pre><code>import Graphics.UI.GLUT
  
  main :: IO ()
  main = do
    (_progName, _args) &lt;- getArgsAndInitialize
    _window &lt;- createWindow "Hello World"
    displayCallback $= display
    mainLoop
  
  display = do
    let color3f r g b = color $ Color3 r g (b :: GLfloat)
        vertex3f x y z = vertex $ Vertex3 x y (z :: GLfloat)
    clear [ColorBuffer]
    renderPrimitive Points $ do
      -- color3f 1 0 0
      -- vertex3f 0 0 0
      return ()
    -- &lt;&lt; error on glEnd() of renderPrimtive &gt;&gt;
  
    flush
    reportErrors
  </code></pre>
  
  <p>Facts:</p>
  
  <ul>
  <li><p>I've tried this with the default <code>glut32.dll</code> that comes with the Haskell Platform (GHC 8.0.2) and I also tried <code>freeglut</code>.  Using gDEBugger, I was able to determine that the <code>glEnd</code> command reports the error first (called by <code>renderPrimtive</code>).  Even with no body (vertices or color changes), the render issues some command that makes OpenGL unhappy (, or the empty command generates a different error).</p></li>
  <li><p>I tried this with other primitives too <code>Lines</code> and even the example program from the link above (uses <code>Quads</code>).</p></li>
  <li><p>The primitives actually render correctly on my screen even with the error.  (But I desire error checking for my own screw ups, so this false positive is bad.)</p></li>
  </ul>
  
  <p><em>Does anyone have an idea how to go about debugging this?</em> Thanks!</p>