Re: Convex polygons
Christopher Lane Hinson <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.hopengl |
|---|---|
| Message-ID | <alpine.DEB.2.00.0903222056160.20836@greatmoo.downstairspeople.org> |
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 > [email protected] > http://www.haskell.org/mailman/listinfo/hopengl >