I need to add ground texture to glutSolidSphere. The problem is that I cannot figure out how to make the texture stretch across the entire sphere and still be able to rotate.
We have included textures.
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE,GL_OBJECT_LINEAR); glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T);
using GL_SPHERE_MAP in the parameter instead of GL_OBJECT_LINEAR makes the textures correct, but they cannot rotate.
The options I use for texture are
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
I understand that GL_REPEAT breaks the texture, while GL_CLAMP instead gives me the texture once on the object, but I cannot make it stretch across the entire sphere.
Does anyone know how to properly texture glutSolidSphere?
source share