realbasic-games
[Top] [All Lists]

Re: OpenGL- drawing from coordinates

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: OpenGL- drawing from coordinates
From: Asher Dunn <asher at fireyesoftware dot com>
Date: Wed, 27 Sep 2006 15:08:03 -0400
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <451A34D6 dot 9060609 at rpgportland dot com> <7B9C1A36-01A2-4320-B69E-DA01B88CBDDD at fireyesoftware dot com>
Another thing: the results for a non-convex polygon are probably device dependent. That is, you will get different things with different OSs, different drivers or different graphics cards. What you're seeing is OpenGL's "best guess" about how to triangulate the polygon. The underlying renderer only deals with triangles, so everything else is converted to triangles before being rendered. It's best to convert things to triangles yourself to avoid unpredictable results. This goes for quads too - while drawing squares using GL_QUADS is easier than drawing squares using GL_TRIANGLES, non- planar quads can produce bad results. Using triangles also avoids the overhead (however small) of triangulating the polygon every frame.

Asher

-------------------------
Asher Dunn
Head Developer, Fireye Software
http://www.fireyesoftware.com/
AIM, Yahoo, MSN: crazedglkid


On Sep 27, 2006, at 3:01 PM, Asher Dunn wrote:

GL_LINE_LOOP draws a line between teach pair of vertices, pairing the first with the last. GL_POLYGON draws a *convex* polygon fitting the passed vertices. You cannot draw a non-convex or self- intersecting polygon, and the results can be messy if you try (as you have seen). I would suggest decomposing the shape into several pieces - maybe a polygon for the center and a triangle for each tip.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>