PDA

View Full Version : 3DS Max texture coordinates help



lostrozzacavalli
10-16-2010, 07:35 AM
Hello guys, I'm new to this forum and to opengl.
I tried to follow some tutorials online and I got my script rendering a 3d object.
I exported this object from 3DS max using a script of my own. At the moment it does only take care of vertices, faces and texture coordinates.
In my c++ project I made a function to import this type of model, and save the values in a struct named "object".
This is the code I used for drawing it:


glBindTexture(GL_TEXTURE_2D, airplane.id_texture);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, airplane.mapCoords);
glVertexPointer(3, GL_FLOAT, 0, airplane.vertices);

// draw a cube
glDrawElements(GL_TRIANGLES, airplane.numIndices, GL_UNSIGNED_INT, airplane.indices);

// deactivate vertex arrays after drawing
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

It renders the airplane alright, but the texture coordinates are completely wrong. I don't think I made my exporter wrong because I tried to export the model as a .ASE file and the texture coordinates where the same.
I also tried to use glVertex3f() and glTexCoord2f() and the result was the same..