[SOLVED]How to properly calculate normals of the box?

Self answered :

The code below calculates and adds surface normals based on its vertices.
(the mode should be set to OF_PRIMITIVE_TRIANGLES)

void ofApp::addSurfaceNormalsToMesh(ofMesh &mesh) {

for (int i=0; i<mesh.getNumVertices(); i+=3) {
    
    ofVec3f v0 = mesh.getVertex(i);
    ofVec3f v1 = mesh.getVertex(i+1);
    ofVec3f v2 = mesh.getVertex(i+2);

    ofVec3f U = v1 - v0;
    ofVec3f V = v2 - v0;
    
    float x = (U.y * V.z) - (U.z * V.y);
    float y = (U.z * V.x) - (U.x * V.z);
    float z = (U.x * V.y) - (U.y * V.x);
    
    ofVec3f normal(x,y,z);
    
    normal.normalize();
    
    mesh.addNormal(normal);
    mesh.addNormal(normal);
    mesh.addNormal(normal);
}

}

Source : https://www.khronos.org/opengl/wiki/Calculating_a_Surface_Normal