groverburger / g3d

Simple and easy 3D engine for LÖVE.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rules for texture mapping?

gustavostuff opened this issue · comments

I created this cube in Blender and texture mapping seems to be ok there, but it acts wierd once I import it on g3d.

This is how it looks when I use the exported obj file along with that same texture:

another look from inside the cube:

For g3d I modified the texture just to show you the actual mapping done by g3d:

Thanks in advance!

I don't know why exactly, but it assumes texture origin to be bottom-left, when it should be intuitively top-left. The g3d.loadObj function supports flipping U and V texture coordinates, in this case you should call g3d.loadObj with the path of the .obj file, false and true to get the correct texture coordinates, and then pass it to g3d.newModel as the first argument. =)