Surface Normal (Again)
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
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
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.)
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
It is at:
http://www.itknowledge.com/reference/archive/1571690735/ewtoc.html
alistair
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement