Hello again friends.
I was just trying to map a texture to a glut solid sphere using automatic texture coordinates. After some hours studying, I realize this won’t be so easy (holy sh*t!! there is no ease way with gfx!). The way to go right is using cube map, but I’m struggling to figure out how the hell this thing work!
After loading a texture and building it with gluMipmap2D, I just set the following lines of code before drawing the sphere:
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
//Do I really need the R coordinate???
glEnable(GL_TEXTURE_GEN_R);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_R,GL_REPEAT);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glEnable(GL_TEXTURE_CUBE_MAP);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, TextEstrada);
glutSolidSphere(10,32,16);
The problem is as follows:
this is Mars, lol. I can see the side of Mars, until…
…I turn the camera! The texture is always facing me!
PS> I didn’t set the 6 sides for the textures 'cause I tried this and I had a problem, the render got crazy and the problem above didn’t go.
Regards!