PDA

View Full Version : Please help with my vertex normals. please.



iNsaNEiVaN
04-20-2001, 02:58 PM
Ok here is my box with one vertex per side (flat shading)

//top
glNormal3f(0.0, 1.0, 0.0);
glVertex3f(1.0, 0.25, -1.0);
glVertex3f(-1.0, 0.25, -1.0);
glVertex3f(-1.0, 0.25, 1.0);
glVertex3f(1.0, 0.25, 1.0);
//bottom
glNormal3f(0.0, -1.0, 0.0);
glVertex3f(1.0, -0.25, 1.0);
glVertex3f(-1.0, -0.25, 1.0);
glVertex3f(-1.0, -0.25, -1.0);
glVertex3f(1.0, -0.25, -1.0);
//front
glNormal3f(0.0, 0.0, 1.0);
glVertex3f(1.0, 0.25, 1.0);
glVertex3f(-1.0, 0.25, 1.0);
glVertex3f(-1.0, -0.25, 1.0);
glVertex3f(1.0, -0.25, 1.0);
//back
glNormal3f(0.0, 0.0, -1.0);
glVertex3f(1.0, -0.25, -1.0);
glVertex3f(-1.0, -0.25, -1.0);
glVertex3f(-1.0, 0.25, -1.0);
glVertex3f(1.0, 0.25, -1.0);
//left
glNormal3f(-1.0, 0.0, 0.0);
glVertex3f(-1.0, 0.25, 1.0);
glVertex3f(-1.0, 0.25, -1.0);
glVertex3f(-1.0, -0.25, -1.0);
glVertex3f(-1.0, -0.25, 1.0);
//right
glNormal3f(1.0, 0.0, 0.0);
glVertex3f(1.0, 0.10, -1.0);
glVertex3f(1.0, -0.25, 1.0);
glVertex3f(1.0, -0.25, 1.0);
glVertex3f(1.0, 0.25, -1.0);

Ive read the theory countless times but how would I declare the VERTEX normals for this cube. I dont want the theory please.

Warrior
04-20-2001, 07:45 PM
go here:
The Red Book (http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/)
READ Chapter 5 and Appendix E.

Good Luck http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by Warrior (edited 04-20-2001).]

dhoffman
04-20-2001, 07:53 PM
What are you talking about, didn't the code you listed already assign the VERTEX normals?

Warrior
04-20-2001, 08:58 PM
What are you talking about, didn't the code you listed already assign the VERTEX normals?

No, he is assigning surface normals.

Tim Stirling
04-21-2001, 06:09 AM
For a cube you will want surface normals unless you are trying to disguise the cube as a cylinder or such like. Vertex normals ona cube would look wired.