+1  A: 

There are 2 normals to the triangle (of course) and the one you get from standard algorithms depends on the order of ther vertices. Quoting wiki

"For a polygon (such as a triangle), a surface normal can be calculated as the vector cross product of two (non-parallel) edges of the polygon."

But the direction of the normal depends on the order of points chosen, you can calculate it and decide using some other heuristics whether the reverse vector is the normal you are interested in.

whatnick
+6  A: 
ChrisF
+1 Good answer, and nice illustrations, thumbs up! :)
Sune Rievers
+1  A: 

The cross product is the right answer. Dont forget to normalise the result, and dont forget that if the triangle has zero area, the result is invalid because there is no well defined normal. Basically, if your three vertices are p0, p1 and p2:

vector temp = cross(p1 - p0, p2 - p0);
if (length(temp) < epsilon) then
    Degenerate_triangle_error;
else
    return normalize(temp);

Also, as the other answer says, whether you get the 'up facing' or 'down facing' normal will depend on the ordering of your vertices.

sdclibbery
+1 Good point about degenerate triangles.
Sune Rievers
A: 

To finish answering your question, once you have the unit normal vector of your triangle you can work out the angle using a dot product.

The dot product of two unit vectors is equal to the cosine of the angle between them, so if you calculate the arccos of the dot product of your unit normal vector and your unit Up vector you will get the slope angle of your triangle (angle away from horizontal).

Also, note that OpenGL conventionally uses a right-handed coordinate system, so if you are using that then your triangle vertices will have a counter-clockwise ordering.

Incredulous Monk