Greetings:
I haven't seen this stated as such in the red book, except that it says
to make sure polygons are convex, but it seems to me what OpenGL does
with a
glBegin(GL_POLYGON);
v0; v1; ... vn;
glEnd();
call is to make a "triangle fan" around v0, viz, v0v1v2, v0v2v3, ...
If the polygon is convex this is no problem, but otherwise it will
depend on the listing order, e.g.,
v0; v1; ... vn-1; vn; may render differently from
v1; v2; ... vn; v0; or
v2; v3; ... v0; v1; etc.
even though they are all the same cyclic order.
Can any one confirm if this is what's actually implemented inside
OpenGL?
Thanks,
Sumanta
|
|
0
|
|
|
|
Reply
|
guha (2)
|
1/26/2005 4:06:25 AM |
|
guha@ait.ac.th wrote:
>
> it seems to me what OpenGL does with a
>
> glBegin(GL_POLYGON);
> v0; v1; ... vn;
> glEnd();
>
> call is to make a "triangle fan" around v0, viz, v0v1v2, v0v2v3, ...
>
What makes you think that?
> Can any one confirm if this is what's actually implemented inside
> OpenGL?
>
OpenGL is a specification not an implementation.
What happens inside one implementation of OpenGL
may not be what happens inside another.
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
Governments, like diapers, should be changed often,
and for the same reason.
|
|
0
|
|
|
|
Reply
|
fungus
|
1/26/2005 5:52:13 AM
|
|
I agree might be an implementation issue (I'm using the Windows
library with Visual C++) but try this polgyon
glBegin(GL_POLYGON);
glVertex3f(50, 10, 0);
glVertex3f(40, 50, 0);
glVertex3f(10, 60, 0);
glVertex3f(90, 60, 0);
glVertex3f(60, 50, 0);
glEnd();
(use
glOrtho(0.0, 100.0, 0.0, 100.0, -1.0, 1.0); for the projection)
then cyclically rotate the vertices..
What I see is the same polygon if polygon mode is GL_LINE, but if it's
the default GL_FILL then the rendering depends on the listing. Which to
my mind, at least for the Windows implementation, is that
(1) GL_LINE simply does the line loop which doesnt depend on order
(2) GL_FILL does the fan around the first vertex which does
So here's the questions again:
What is the "official" OpenGL spec for rendering a polygon?
Are there implementations that do differently from what the Windows
library seems to be doing?
Sumanta
|
|
0
|
|
|
|
Reply
|
guha
|
1/26/2005 6:29:48 AM
|
|
guha@ait.ac.th wrote:
>
> What I see is the same polygon if polygon mode is GL_LINE, but if it's
> the default GL_FILL then the rendering depends on the listing.
This isn't surprising. The polygon will most
likely be split internally into triangles and
this can depend on input order.
> (2) GL_FILL does the fan around the first vertex which does
>
OTOH a fan isn't the nicest way to split a polygon
for rasterization. If it was me I'd prefer a strip.
> So here's the questions again:
>
> What is the "official" OpenGL spec for rendering a polygon?
The answer is the same...there is no official spec.
for this. A concave polygon produces "undefined"
results. That means you can't depend on *anything*.
OpenGL only defines some very basic rules for
rasterisation, mainly concerning which pixels should
be covered by a polygon and which not. Everything else
is quite loose.
eg. The spec specifically says that depth values
generated aren't garanteed to be exactly the same
for two polygons if you change OpenGL state (eg.
enable or disable texturing).
If you play around a bit you'll also find that the exact
shading of polygons (eg. the precise color of the pixel
in he center of a quad) will vary with input vertex
order and also when the quad is clipped to the edge
of the viewport. This is an artifact of triangulation.
--
<\___/>
/ O O \
\_____/ FTB. For email, remove my socks.
Governments, like diapers, should be changed often,
and for the same reason.
|
|
0
|
|
|
|
Reply
|
fungus
|
1/26/2005 7:49:41 AM
|
|
|
3 Replies
399 Views
(page loaded in 0.083 seconds)
|