HI all,
I’m having a very odd problem. I’m using lib3ds to load a 3ds file and I’m having problems with the textures since they appear distorted but they do not appear always. When I load the 3ds file I then convert the 3ds structure into my own structure and I do:
GLuint texID;
glGenTextures(1, &texID);
glBindTexture(GL_TEXTURE_2D, texID);
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_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
Now, I do:
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, w, h, GL_RGB, GL_UNSIGNED_BYTE, ti->image);
and the texture shows up distorted. If I do:
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, ti->image);
the texture won’t show up at all…
Of course that when I’m going to send the texcoord I do:
glEnable(GL_TEXTURE_2D); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glBindTexture(GL_TEXTURE_2D, tInfo->glID);
I’m not doing anything else to the textures, and I’m scaling the object in which the texture appears, I really don’t know if I need to do anything to the texture. It is 256x256 so it’s not too big. I really don’t know what’s happening. :-/ Why is it showing up with gluBuild… and not with texImage2D? Why is it distorted? Any ideas or things to experiment?
Cheers,
Paulo Matos