Skip to main content
GameDev.net gamedev.net
🔒 Locked

Surface Normal (Again)

Started by Iceman May 14, 2000 at 6:55 AM 3 replies 850+ views
Original Post
Iceman
Iceman
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
alistair b
alistair b
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
Iceman
Iceman
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.)
alistair b
alistair b
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
Morgan
Morgan
Also, Nate (nate.scuzzy.net) has a good tutorial on normals and stuff.

Morgan

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.