I'm working with Opengl ES 2 on iphone and right now I am trying to get my textures working on my objects. I'm using .obj files and all the data in them are correct. I have written a parser myself to开发者_开发问答 retrieve all data, I convert it to static arrays in C. I discard the material properties for now, only getting the image path from the .mtl files manually.
I have an object with 336 triangles, making this non-trivial to observe, with appertaining vertices, vertex faces and texture coordinates (u,v).
Passing all data into the shaders, the resulting image is this:
http://img530.imageshack.us/img530/9637/pic1io.png
http://img404.imageshack.us/img404/7358/pic2pg.png
But it should look like this (Displaying it in an object viewer). Please ignore the material properties.
http://img16.imageshack.us/img16/1401/pic3cq.png
Using this image as a texture:
http://img217.imageshack.us/img217/1300/shirtdiffuse.png
I'm thinking it might have to do with texture coordinate faces ? It is defined in my .obj file, and I'm not using them at all. In books and tutorials I have not found anything concerning this.
Regards Niclas
Have you tried to flip the texture vertically? Some times when a texture has been loaded it is layed out in memory so the vertical lines come in the opposit direction as intended in the texcoords.
精彩评论