Archived

This topic is now archived and is closed to further replies.

trysil

Two questions

Recommended Posts

trysil    122
Hi! I''m reading that excellent book "Opengl Game programming" and a lot of screws have been tightened. Except one. When using backface culling opengl requires the object to be specified clock/counterclock wise. I understand what that means in 2d but I have a hard time translating that to 3d. Someone with a simple explanation? 2. Portals. I understand the theories behind this but I would like to se some hands on description. Someone? "A witty and slightly sarcastic quote from an unkown source" -- The generic SIG /trysil

Share this post


Link to post
Share on other sites
eldee    122
ok, lets say you''ve got the order set to counter clockwise (GL
default), and you''re staring at a cube..
the quad that you see is going counter clockwise (according to
your perspective), and the backface quad is going clockwise (also
according to your perspective).. its kinda like working with a bolt. if you turn it clockwise, it gets tighter, counterclockwise
it gets looser. but if you were to go to the other side of the
object you were screwing (heh), you''d actually be turning it
counter clockwise (according to your perspective) to get it
tighter, and not clockwise. see? i dont know if that made any
sense, but the trick here is to understand that the order is
all relevant to your perspective (what you''re looking at).
essentially, when you''re looking at that cube, GL knows to cull
anything that''s "going the wrong way" (clockwise in this case).
hope this helps and doesnt confuse you further

-eldee
;another space monkey;

Share this post


Link to post
Share on other sites
trysil    122
Let''s se i f I understood: As long as each poly of the object is specified clockvise the 3d object
is specified clockvise?



"A witty and slightly sarcastic quote from an unkown source"
-- The generic SIG

/trysil

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Further clarification, hopefully. You must decide first of all
if you are going to wind your polygons (traverse the vertices)
in a clockwise or counter-clockwise fashion. Once you''ve made
the appropriate decision, you describe ALL your poly''s in that
direction. The API can then determine at render time, based
on the perspective, if the polygon is visible. Say you specify
CCW (counter-clockwise). During rendering a poly facing you
will be described in a CCW direction, but a poly facing away
from you will be CW simply by virtue of the perspective. The
important thing to remember is you traverse your poly''s in the
same direction ALWAYS, and the back-face culling comes for "free"
by virtue of perspective.

HTH,
Squid56

Share this post


Link to post
Share on other sites