I have also re-generated sphere triangulation data, so now all the five obj files having texture data. Download sphere1.obj, sphere2.obj, sphere3.obj, sphere4.obj, sphere5.obj.
If you want to generate a realistic looking earth, you need to download this image.
GLuint texName[2]; // replace 2 (in the next line too) with the actual number of texture objects you want to create. glGenTextures(2, texName);
glBindTexture(GL_TEXTURE_2D, texName[0]); // or texName[1] to initialize the second texture object just created above. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); // clamping if s texture val out range of [0,1]. The other common choise is GL_REPEAT. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); // clamping if t texture val out range of [0,1]. The other common choise is GL_REPEAT. /* these are anti-aliasing related issue, you dont have to understand .*/ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); /* Now bind the actual image to be texture mapped for this texture object There are a few important things you have to be VERY careful, 1. you must pass the correct data type of the color component in your image. 2. the image size must be 2^m + b and >= 64, where ususally b = 0 as below, */ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, checkImageWidth, checkImageHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, checkImage);
glBindTexture(GL_TEXTURE_2D, texName[0]); glBegin(...); ... glTexCoord2f(s, t); glVertex3f(x, y, z); // this vertex is related to the texture coordinate (s,t) just given. glEnd();
1.3.6