openframeworks / openframeworks/openFrameworks
ofxAssimpLoader::getMesh with texture only draws correctly with ofDisableArbTex()
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I thought that rendering a .obj model loaded by ofxAssimpLoader would be pretty simple, something like:
ofMesh mesh = loader.getMesh(0);
ofTexture tex = loader.getTextureForMesh(0);
tex.bind();
mesh.draw();
tex.unbind();
There's one more important step, ofMultMatrix(loader.getModelMatrix());, but even with this the texture map doesn't seem to work correctly. As far as I can tell, it has something to do with normalized vs unnormalized textures, but I don't have more details.
I made a full minimal example that works when ofDisableArbTex() is called, but uses the top left corner of the texture for the entire model when it is not called: https://gist.github.com/kylemcdonald/4ef96ffc1cc67c860fb35c38c71e6f51
With ofDisableArbTex():

Without ofDisableArbTex():

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal example in the linked gist and reproduce the difference with and without ofDisableArbTex(). Trace the texture-coordinate handling around ofxAssimpLoader::getMesh and getTextureForMesh, then verify that the textured model maps correctly without requiring the workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100