Well, here''s a (pretty horrible) hack that''ll fix the seams:
void Icosahedron::DrawTriangle(float *v1, float *v2, float *v3) { Vector3f point; GLfloat texU, texV; GLfloat texU1, texU2, texU3; GLfloat texAdd1 = 0; GLfloat texAdd2 = 0; GLfloat texAdd3 = 0; // determine if triangle spans point.Set (v1[0], v1[1], v1[2]); GetTextureCoord (&point, &texU1, &texV); point.Set (v2[0], v2[1], v2[2]); GetTextureCoord (&point, &texU2, &texV); point.Set (v3[0], v3[1], v3[2]); GetTextureCoord (&point, &texU3, &texV); if (texU2 - texU1 > 0.2 || texU3 - texU1 > 0.2){ texAdd1 = 1; } if (texU1 - texU2 > 0.2 || texU3 - texU2 > 0.2){ texAdd2 = 1; } if (texU1 - texU3 > 0.2 || texU2 - texU3 > 0.2){ texAdd3 = 1; } glBegin(GL_TRIANGLES); point.Set (v1[0], v1[1], v1[2]); glNormal3f (point.x, point.y, point.z); // (Points are already normalised) GetTextureCoord (&point, &texU, &texV); glTexCoord2f(texU + texAdd1, texV); glVertex3f (point.x, point.y, point.z); point.Set (v2[0], v2[1], v2[2]); glNormal3f (point.x, point.y, point.z); GetTextureCoord (&point, &texU, &texV); glTexCoord2f(texU + texAdd2, texV); glVertex3f (point.x, point.y, point.z); point.Set (v3[0], v3[1], v3[2]); glNormal3f (point.x, point.y, point.z); GetTextureCoord (&point, &texU, &texV); glTexCoord2f(texU + texAdd3, texV); glVertex3f (point.x, point.y, point.z); glEnd();}
It could be optimised, but since it''s such a hack there''s no point. The value 0.2 is just a value < 1 that is guarenteed to be greater that the difference between any two correct texture coordinates.
It does work - I''ve just spent the last hour hacking various bits of old code together to get a simple OpenGL app to display it. It fixes both problems - I still don''t know what caused the second one but nevermind!
Enigma