PDA

View Full Version : Flat shading with vertex array

02-05-2001, 04:05 AM
I need to implement a flat shading using vertex array.
I have reached a perfect smooth shading computing the average of triangle's normals sharing each vertex and assigning them to the corresponding elements of normal array.
vertex[i] ---> normal[i] = average of sharing triangles normals;
But, this doesn't work on flat shading.
I know that to reach a correct result I should have to assign the triangle normal to all its vertices normals, but the problem raises on shared vertices.
I don't want to duplicate the shared vertices to keep their normals and, for speeding problems, I can't draw my triangles one by one.
How can I solve my problems?

Thanks

DFrey
02-05-2001, 05:08 AM
You have to duplicate the vertices. There is no way around it (other than using immediate discrete triangles).

02-05-2001, 05:48 AM
Could you give me further information about immediate discrete triangles?

Thanks

DFrey
02-05-2001, 05:51 AM
That's means drawing triangle's one by one in a begin/end pair (what you do not want to do).