[HOpenGL] Convex polygons
Christopher Lane Hinson
lane at downstairspeople.org
Sun Mar 22 22:02:06 EDT 2009
Your result is typical. OpenGL has to tesselate the polygon into
triangles. In some cases it will tesselate a concave polygon correctly.
For example, if you plot that using TriangleFan, I'm doing this mentally,
but I think it comes out correctly.
Also, convex is the kind of polygon that opengl *can* render. The polygon
you described is concave.
If you were hoping to render the convex hull of the polygon, you'll have
calculate that yourself.
--Lane
On Sun, 22 Mar 2009, Rafael Cunha de Almeida 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