Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Face normals

  1. #1
    Intern Contributor
    Join Date
    Dec 2001
    Location
    Porto Velho
    Posts
    98

    Face normals

    How to calculate the normals(and normalize) of this quad?

    Code :
    	GLfloat vertices_x1;
    	GLfloat vertices_y1;
    	GLfloat vertices_z1;
     
    	GLfloat vertices_x2;
    	GLfloat vertices_y2;
    	GLfloat vertices_z2;
     
    	GLfloat vertices_x3;
    	GLfloat vertices_y3;
    	GLfloat vertices_z3;
     
    	GLfloat vertices_x4;
    	GLfloat vertices_y4;
    	GLfloat vertices_z4;

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Face normals

    Assuming the quad is planar. Create two vector from one vertex to two other vertices. The normal is the crossproduct of the two vectors. To normalize it, divide all components by it's length.

    It's very basic maths that one should understand when doing 3D graphics. Have a look here .

  3. #3
    Member Regular Contributor
    Join Date
    Feb 2002
    Posts
    377

    Re: Face normals

    just for a little more speed when normalizing

    calculate 1/length instead of length and multiply your components by this factor

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •