Texturing with Vertex Arrays

Started by
1 comment, last by GamerSg 20 years, 11 months ago
I am using the 3ds Loader from gametutorials and modified some parts so that it will output all the vertices into a text file with the indices, texture coordinates. So i exported a simple model to .3ds and ran the program. Before applying texturing, there were like 12 vertices. The problem comes after applying textures. The vertices suddenly explode to 48! I understand the reason is because when using vertex arrays, there need to be the same number of vertexes as Texture coordinates. But this defeats the whole purpose of using vertex arrays because now i have about 4 duplicates of the same vertexes. If i take away the texturing, it goes back to the original number of 12 vertices. So i was wondering if there is anyway i can keep the vertices to 12 and maybe use another indices array specially for textures.
Advertisement
You mean it stores 48 vertices in the file now instead?
Hmm maybe i was not clear enough.

In 3d studio, there are still 12 vertices no matter how i apply the textures, but due to the way most 3d software programs save their data, they save it in a format similar to vertex arrays, where all unique vertexes are stored with indices values.

Texture coords and normals also use the same indices. So if there are more unique texture coordinates then unique vertices, the vertices are repeated so that they match the number of texture coordinates.

This topic is closed to new replies.

Advertisement