What are the normals for 3d cube as used in OpenGL ES?

前端 未结 2 1757
滥情空心
滥情空心 2021-02-09 03:19

I have a cube defined as :

  float vertices[] = {
            //Vertices according to faces
                -1.0f, -1.0f, 1.0f, //Vertex 0
                1.0f,          


        
2条回答
  •  醉话见心
    2021-02-09 03:59

    The normal of a surface is simply a direction vector. Since the normal will be the same for two surfaces that are coplanar, you will only need 6 surface normals. However, often, it's the case that normals are expected to be defined per vertex, in which case you'll need 36 (one for each vertex of each triangle on each face of the cube).

    To compute the normals, simply use the following calculation: http://www.opengl.org/wiki/Calculating_a_Surface_Normal

提交回复
热议问题