#### Archived

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

# VertexArrays and Normals

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

## Recommended Posts

Hi, assume I''ve got an array of 8 Vertices, and an Array with the data of the polys, forming a cube. (sorry sad English). OpenGL gets an index out of the polys array and sets the Vertex like glVertex3fv (Vertices[Polys]) and if I want to use a normal array Normals [Polys[i]]. And now my problem. I have to calculate a normal for every Vertex, but one vertex builds more than one poly, so it has (e.g. in the cube) 3 Normals. How can I calculate them? I thought I add the 3 Vectors and normalize the sum of the 3 Polynormals, but that sems for me not right. Any suggestions out there? Bosso

##### Share on other sites
There is no one way to calculate normals -- you can do it however you want (of course you will get strange results if you do something that makes no sense). If you have a procedural shape, such as a cyclinder, you could calculate the normals from the equation of a cylinder. Usually if you have a mesh with no normal information and you want it to look smooth, you calculate the vertex normals by averaging the surrounding face normals. However, if you want a faceted shape, such as a cube you set the vertex normal to the face normal -- THIS MEANS THAT IN SUCH A CUBE THE FACES WILL NOT SHARE THE SAME VERTICES, because even though the faces have vertices with the same position, they require different normals. You can also just change the shade mode to flat to draw faceted objects.

1. 1
2. 2
frob
15
3. 3
4. 4
Rutin
12
5. 5

• 13
• 12
• 58
• 14
• 15
• ### Forum Statistics

• Total Topics
632120
• Total Posts
3004220

×