To calculate the normal, take the cross product of the two vectors formed by v1 = (tri_x[1]-tri_x[0];tri_y[1]-tri_y[0];tri_z[1]-tri_z[0]) and v2 = (tri_x[2]-tri_x[0];tri_y[2]-tri_y[0];tri_z[2]-tri_z[0]). Don’t forget that v1^v2 = -v2^v1.
Wow! I think there is an epidemic about normals computation issue this week, perhaps the premices of the april, 1st virus… Seriously, an article about this on the opengl wiki might be helpful.
if your model is hard-edged, like box, one normal per triangle is OK;
if your model is curved, like sphere, the normals must represent the actual ones on the curved surface rather than the ones on the approximate polyhedron model.
sometimes both kinds of normals even exist on the same model.
in order to make the result as you expect, OpenGL just leave the work to you.
And for the sake of completeness, most meshes not have only one normal per vertex but several, especially at hard edges. This follows what ephtracy said, vertex normal depend on the triangle it belongs to, that is why it could have several normals on hard edges.
I advise you to play withy normals in 3d modelers like 3dsmax, blender, maya and friends just to understand this concept.