openframeworks / openframeworks/openFrameworks

ofxAssimpLoader::getMesh with texture only draws correctly with ofDisableArbTex()

Open
#6,218 3 comments 0 reactions 0 assignees View on GitHub

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():

screen shot 2019-01-27 at 12 02 43 pm

Without ofDisableArbTex():

screen shot 2019-01-27 at 12 03 17 pm

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.