Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Iceman

Surface Normal (Again)

This topic is 6913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!