Link to home
Start Free TrialLog in
Avatar of thrawn80
thrawn80Flag for Singapore

asked on

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!

Regards,
Jeremy
ASKER CERTIFIED SOLUTION
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have you remembered to enable lighting?
Avatar of thrawn80

ASKER

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!

Regards,
Jeremy
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..)
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).

:(
Rehi,

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.

*Sigh*

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?

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

:\