Learn how to a build a cloud-first strategyRegister Now


Front and Back sides of a polygon

Posted on 2006-05-12
Medium Priority
Last Modified: 2013-12-06
Hi all,

Can anyone tell me how do I determine the FRONT and BACK side of a polygon?

is it true that the +Z face is always the back, the -Z face is always the front?

I'm asking this becoz my glLighting isn't lighting my model correctly ... even though it did light the glutWireTeapot and glutSolidTeapot properly.

Please reply asap, I need to know it urgently...

PS,  i read some articles that suggests that the FRONT and BACK are determined by the way you place ur vertices in between glBegin and glEnd... pls comment on that too.

Thanks A LOT!

Question by:thrawn80
  • 5
  • 3
LVL 25

Accepted Solution

InteractiveMind earned 640 total points
ID: 16668406
Yes, in a right-handed coordinate system (the default for OpenGL), the -Z axis points AWAY from the screen, whereas the +Z comes out other screen..

> "i read some articles that suggests that the FRONT and BACK are determined by the way you place ur vertices in between glBegin and glEnd"

Yes, this is true.

It depends on the order in which you define the vertices within the polygon, and the corresponding declaration for glFrontFace.

If glFrontFace() is given the value GL_CW, then if the points are defined in a clockwise (CW) direction, then the front of the polygon faces you. But if you were to do it CCW (counter-clockwise), then the front will be facing away from you.

(See here: http://www.mevis.de/opengl/glFrontFace.html )
LVL 25

Expert Comment

ID: 16668409
Have you remembered to enable lighting?

Author Comment

ID: 16669153
hi InteractiveMind,

Yes of course I've enabled lighting :)

thanks for reminder anyway... my problem is that the lighting is wrong, not invisible. :)

I'll go and check things out and get back to u asap... thanks for your response!

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

LVL 25

Expert Comment

ID: 16669247
Just checking; it's so easy to define all the light settings, and then forget to actually add the glEnable(..).

> "the lighting is wrong"
What is so "wrong" about it? Any chance of seeing a screenshot? Some code?
(..unless of course you figure it yourself..)

Author Comment

ID: 16669525
If let's say my article is a house with a hole in the roof

and there is a sun that rises and set, (a X=0, Y=sin angle * dist, Z = -cos angle * dist) curve lighting just like the sunlight or moonlight, how do i make the house appear to be in darkness, yet, casting a hole of light via the hole in the roof?

PS, the roof is a nicely cut square, just like a skylight.
LVL 25

Expert Comment

ID: 16669570
I think you're over-estimating OpenGL lighting.

This sort of effect would require either something like a custom Cg shader (for a good effect), or using a translucent shape/graphic to provide some sort of glowing effect, et al. (a cheap and pretty poor effect).


Author Comment

ID: 16670277

I think it's becoz I'm still a newbie in 3d graphics that's y i dunno much about lightings... neither do i know the capabilities of default lightings in OpenGL.


Unfortunately I do not have much time left for this project of mine, the due date is drawing near. As for a screenshot, I'll try to post it asap.

Anyway, let's say, if I split my wall into small fragments of polygons, will it hav a better effect?

LVL 25

Expert Comment

ID: 16671706
If I understand your problem correctly, then most probably, yes.


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question