I'm trying to create a simple .obj loader but whenever I use it, the model displayed has it's texture messed up. I've loaded the same file using a loader created by someone else so I know that the problem isn't with the texture itself. I've checked the data loaded and compared it to the data stored in the file and they appear to be the same thing so I'm unsure of what's causing the problem. My function is:
I don't know if it's the same problem I had. In blender, the UV coordinates seamed to be measured from a different corner of the texture than when I render in blender. Separate copies of the texture flipped vertically, one for blender one to load in openGL, fixed my problem.
I was using the basic loader from opengl-tutorial.org.
I already tried that but it didn't help. Right now I'm trying to find any small mistakes in my code that I could have previously looked over. Also, here is a link that compares what I get to what I should be getting: http://imageshack.us/a/img849/569/7pj5.png
I've looked at that function and tested it (it works perfectly) but can't figure out what he's doing to read the file that makes it different from mine enough that it works.
Edit: I finally found the problem. Where I was loading the UV coordinates for the texture, I added the vec2 before it was completely filled. i.e If one of the UV coordinates was (3,2) it would add (3,who knows) to the vector.
Last edited on
Topic archived. No new replies allowed.
You are using a version without Ads of this website. Please, consider donating: