Front and Back sides of a polygon

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!

Who is Participating?
InteractiveMindConnect With a Mentor Commented:
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: )
Have you remembered to enable lighting?
thrawn80Author Commented:
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!

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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..)
thrawn80Author Commented:
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.
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).

thrawn80Author Commented:

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?

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.