🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Surface Normal (Again)

Started by
3 comments, last by Iceman 24 years, 1 month ago
I've tried to specified the simple square plain surface normal. Can you guys tell me if I understand it right? Here's my code: glBegin(GL_QUADS); glNormal3f(-1.0f, 1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f); glNormal3f(-1.0f,- 1.0f, 1.0f); glVertex3f(-1.0f,-1.0f, 1.0f); glNormal3f( 1.0f,-1.0f, 1.0f); glVertex3f( 1.0f,-1.0f, 1.0f); glNormal3f( 1.0f, 1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f); glEnd(); Edited by - Iceman on 5/14/00 7:00:57 AM
Advertisement
The normal vector points out from the quad, so the normal
should be the same at all four vertices. (it also has a length of one unit so x*x + y*y + z*z=1)

also I don''t think you need to keep redefining the normal - they are all the same. so you could try something like:

glBegin(GL_QUADS);
glNormal3f(0.0f, 0.0f, 1.0f);
glVertex3f(-1.0f, 1.0f, 1.0f);
glVertex3f(-1.0f,-1.0f, 1.0f);
glVertex3f( 1.0f,-1.0f, 1.0f);
glVertex3f( 1.0f, 1.0f, 1.0f);
glEnd();

i hope this is right

alistair
OK, Thanks
But I still confuse about Surface Normal anyway.
Anybody can tell me the good source about this topic?
(I didn''t know anything about vector at all.)
You should look at the OpenGL Superbible for info on this type of thing. Chapter 9 Section "Using a Light Source - Surface Normals" is what you want.

It is at:

http://www.itknowledge.com/reference/archive/1571690735/ewtoc.html


alistair
Also, Nate (nate.scuzzy.net) has a good tutorial on normals and stuff.

Morgan

This topic is closed to new replies.

Advertisement