Adding a Texture to an Object #773
Unanswered
CounterParry
asked this question in
Q&A
Replies: 1 comment
-
The easiest way is to export your OBJ with a MTL file (it defines the textures to apply to the model, lovr will use that and automatically load all the textures and material properties). If that isn't possible, you can use function lovr.load()
model = lovr.graphics.newModel('head.obj')
tex = lovr.graphics.newTexture('head.png')
end
function lovr.draw(pass)
pass:setMaterial(tex)
pass:draw(model, ...)
end This approach doesn't work with complicated models that have multiple meshes and materials, since it applies the same texture to all the parts of the model. But for simple models it works okay. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How would you draw the model with the texture? I looked though the guide and seen no examples except for skyboxes. Is there no setTexture command for Model?
Beta Was this translation helpful? Give feedback.
All reactions