about normal agian

Use glArrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal for each triangle.

Hi,what is this supposed to mean:“Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal for each triangle”.

how can i specify a single normal for a triangle?!

by the way,i really be a newbie,what is a normal are in computer graphic,it’s belong to a vertex,or polygon,or both?so,if i use the vertex array to draw my mesh,and i have vertex position array,do i have to need a normal array,which each element correspond with each element of vertex array?THANKS~

In computer graphics normal is most commonly unit length vector pointing away from surface, for the purpose of defining orientation of the surface. Normals are required for lighting computations.

Normal is commonly set for vertices, and fragments inside primitive have normal value interpolated from corner normals. Per vertex normals have, by definition, values for each vertex. These values can be computed in a number of different ways, providing more smooth look, or flat per polygon normal look.

If you use vertex array and want to use normals, you will need to setup normal pointer also. This pointer can point to a separate array, or you can interleave normals into the same array with vertex positions. When using interleaved array, there is exactly one vertex position and one normal for each vertex.

It is also common to have normal map textures, where surface is covered with a texture, and texture lookup can retrieve normal, enabling more surface detail than per vertex normals.

You can duplicate vertices for each triangle. While vertex positions have identical values, you can now set unique values for normals in each triangle. So with some added memory consumption you get full flexibility to set unique values for any vertex attributes per primitive.

OK,i have another question,if i have a mesh file exported from 3ds max,which consitis of triangule list,i want to convert it to mesh consitis of tranule strip,then originally each vertex in each triangule face has a normal,after converting,how should a arrange the normals again???

A simple approach would be to copy the face normal 2 times - one per vertex of the triangle strip. This is safe because a face has 1 normal, and a triangle is constructed from 3 points which, by definition, must lie on a plane. Therefore all verticies in a triangle can have the same normal.
Of course you can get a bit more fancy and average the normals from one face to the next adjacent face, so that verticies which are shared between two faces would get a hybrid value of the two face normals.

But i think duplicate the vertex is an optional way,we have not MUST do that,haven it?If i often use triangle list,and why does indexed array exist in opengl??If i use triangle list,even if the adjoing triangles sharing the edges,we have to use duplicated vertices to represent vary triangle,what does the index array use for,which means we cant use index array to reduce the vertexes,seems index array is meainless?

But i think duplicate the vertex is an optional way,we have not MUST do that,haven it?If i often use triangle list,and why does indexed array exist in opengl??If i use triangle list,even if the adjoing triangles sharing the edges,we have to use duplicated vertices to represent vary triangle,what does the index array use for,which means we cant use index array to reduce the vertexes,seems index array is meainless?

That’s pretty much the most incomprehensible set of sentances I’ve ever read. However, I think you are questioning the use of an indexed element array (glDrawElements) verses non-indexed (glDrawArrays).
The choise between glDrawElements and glDrawArrays is down to you - you know your data sets and you know if you even have an index. It’s often more efficient to draw using glDrawElements as you are passing less data though GL. For small sets of data it’s not really that important on today’s hardware.
In any case I think you are mixing this up with what has been said. You were asking about Normals and Vertex data in an array. OpenGL can only have 1 set of indexes, so if we have shared vertices (between two adjacent triangles), AND we have different values for normals, then we need to duplicate the verticies so that each pair of verticies and normals are uniquely indexed in the arrays. If we happen to find that we have a vertex and normal pair which we have already specified before, then we can simply re-use an existing pair and re-specify the index for that. If we have a lot of these situations, then suddenly we find the amount of data we are sending to OpenGL is smaller in the indexed case versus sending in every vertex and normal regardless.

are you sure about the opengl has only one set of indexes,not a index array for pisitions,a index array for normals,and a index array for textures???

Indeed OpenGL only has one set of indices.