A simple question:

I draw a triangle under OpenGL:

glBegin(GL_TRIANGLES);

glVertex3f( 4.0f,2.0f,0.0f);

glVertex3f( 2.0f,4.0f,-2.0f);

glVertex3f(0.0f,3.0f,-1.0f);

glEnd();

How to make to calculate the normal of this triangle?

# Calculate normal of a triangle

Cross Product.

Yup, crossproduct is the way to go. Take (v2-v1) x (v2-v3) to get the normal (you might have to switch order of the vectors to end up with a normal pointing in the correct direction, based on the system you use, left or right-handed)

Of course, you must normalize the vector you get out of the cross product.