[HOpenGL] Convex polygons

Jeff Heard jefferson.r.heard at gmail.com
Sun Mar 22 19:31:22 EDT 2009


No, HOpenGL doesn't do anything behind the scenes; it's not that
OpenGL can't render convex polygons so much as it's a bad idea to
count on it rendering them.  It's entirely implementation (read video
card) dependent as to whether it can render them and if it can how
complicated they can be before the implementation breaks.  It's sort
of like how IE and Firefox will render HTML that isn't XHTML compliant
or even truly really HTML.  It's much better practice to tesselate
using the GLU functions or your own tesselator than it is to count on
features that are only there to correct the occasional programmer
mistake.

On Sun, Mar 22, 2009 at 5:27 PM, Rafael Cunha de Almeida
<almeidaraf at gmail.com> wrote:
>
> I'm reading the red book and it says opengl cannot render convex
> polygons. Yet, when I compile this code:
>    renderPrimitive Polygon $ do
>        vertex $ Vertex2 0 (0::GLfloat)
>        vertex $ Vertex2 0 (3::GLfloat)
>        vertex $ Vertex2 4 (3::GLfloat)
>        vertex $ Vertex2 3 (1.5::GLfloat)
>        vertex $ Vertex2 4 (0::GLfloat)
> The convex polygon is displayed correctly. Does hopengl do something
> behind the scenes or I just "lucked" out that my opengl/hardware can
> handle this particular convex polygon case?
> _______________________________________________
> HOpenGL mailing list
> HOpenGL at haskell.org
> http://www.haskell.org/mailman/listinfo/hopengl


More information about the HOpenGL mailing list