Original Post
I've managed to get the texture on the mesh correctly, however I'm not sure about my normal calculations.. In fact I'm not sure about any of it. I'm trying to build Tri Strips and I really need help on calculating the Normals.I need to calculate the face normals first, which can be done using cross product right ? For example (from the code beneath) va.X = u.X - v.X; va.Y = u.Y - v.Y ; va.Z = u.Z - v.Z ; vb.X = u.X - v.X; vb.Y = u.Y - v.Y ; vb.Z = u.Z - v.Z ; face = crossproduct(va,vb); face = Normalize(facet); Once done, each of the vertex normals is the average of the 6 surrounding faces: glNormal3f(face.X/6,face.Y/6,face.Z/6); ???? for each call to glNormal() ? Do I need to take into account boundary values like edges or borders ? Is this correct ? Kind Regards to you all /////////////////////////////////////////////////////////////////////Ter Gen for (int x = 0; x < MAP_SIZE - 1; x++) { // Draw A Triangle Strip For Each Column Of Our Mesh glBegin(MODE); for (int y = 0; y < MAP_SIZE - 1; y++) { glBindTexture(GL_TEXTURE_2D, texture[0]); float_x = (float) x /MAP_SIZE-1; float_y = (float) y /MAP_SIZE-1; float_xb = (float) (x + 1) / MAP_SIZE-1; float_yb = (float) (y + 1) / MAP_SIZE-1; u.X = mesh[x][y][0];//vertex 1 u.Y = mesh[x][y][1]; u.Z = mesh[x][y][2]; v.X = mesh[x+1][y][0];//vertex 2 v.Y = mesh[x+1][y][1]; v.Z = mesh[x+1][y][2]; u.X = mesh[x][y+1][0];//vertex 3 u.Y = mesh[x][y+1][1]; u.Z = mesh[x][y+1][2]; v.X = mesh[x+1][y+1][0];//vertex 4 v.Y = mesh[x+1][y+1][1]; v.Z = mesh[x+1][y+1][2]; n = crossproduct(u,v); n = Normalize(n); glTexCoord2f(float_x, float_y); glNormal3f(n.X,n.Y,n.Z); glVertex3f(mesh[x][y][0], mesh[x][y][1], mesh[x][y][2]); glTexCoord2f(float_xb, float_y); glVertex3f(mesh[x+1][y][0], mesh[x+1][y][1], mesh[x+1][y][2]); glTexCoord2f(float_xb, float_yb); } glEnd(); }