PDA

View Full Version : how to see both side of a polygon?



sheesh
04-15-2001, 11:54 PM
Hi folks.
this is a nightmare.
how do u see the front as well of a back of a simple polygon ?
when i rotate it with keyboard, the back plane is not showing.

glLightModeli(GL_LIGHT_MODEL_TWO_SIDES, GL_ TRUE);

i added the following but it ain't doing a thing!

pls. help. I am on verge of tears.
thnks

*sheesh*

ffish
04-16-2001, 12:22 AM
By default, glPolygonMode() should be GL_FRONT_AND_BACK. If you've changed it, try glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

Also, it looks as if you're using lights. Are you sure that the back face of the polygon is lit? It may be obscured from the light and as such won't show anything.

One last thing, are you sure that the rotation is correct? It may be that the polygon is rotating off the screen before you see the back face.

Hope those give you something to think about http://www.opengl.org/discussion_boards/ubb/smile.gif

vrempire
04-16-2001, 02:47 AM
Do you correctly specify the normal of the face?

try adding :

glEnable(GL_NORMALIZE);

Michael Steinberg
04-16-2001, 03:52 AM
Do you specify the vertices counter-clockwise (which is default for front-facing in OpenGL)?

Dodger
04-16-2001, 04:15 AM
glDisable(GL_CULL_FACE) should help. Don't forget to turn this back on for objects that don't have any visible backfacing polygons though... increases performance http://www.opengl.org/discussion_boards/ubb/wink.gif

sheesh
04-16-2001, 04:36 AM
thks guys.

i found the prob.
good grief! i noticed this line
glEnable(GL_CULL_FACE)..and hmm..what on earth is cull face thingy doing there...and after 2 hours and 2 cups of coffee later, it downed onto me! DUH. That's what i have been loosing sleep for 5 days?!? *knocks head on wall*

now onto bigger problems.
when i compile the polygon is somewhere outthere. i can't find it till i search it using keyboard.
when they say z is default pointing negative way that means z positive is "pointing towards me on from the monitor" and negative is "towards the back of the monitor".
hope this dun sound like a silly question.

Cheers!
*sheesh*

sheesh
04-16-2001, 04:40 AM
Wish u had replied much earlier dodger.

thks guys.

pleopard
04-16-2001, 05:04 AM
This question keeps coming up again and again. Sorry I didn't see your post earlier too. That problem bit me very hard a while back and I don't think i'll ever forget it. I think it should be posted it in the FAQ.