& org . LABO . Resources . Realtime Texture rendering on 3D model


A blend of ofTexture, ofFBO and ofx3DModelLoader addons

The code below runs in OpenFrameworks v0.7.4. It hasn't been tested in other release.
It uses a hack of the addons "ofx3DModelLoader", that's why the code of the addons has been added in the project.

How it works

  1. Each image resource is stored in an AlphaResource struct. 
    AlphaResource has 2 textures. An alpha mask (b&w) and the result of the mask 
    applied on the image, called "mixture". 
    [ testApp.h, line 14 ]

  2. To render the final texture, all resources and alpharesources are mixed in an
    [ testApp.cpp, line 104 ]

  3. The pixels of the final textures are copied into a MipMaps texture on the GPU
    level by the "gluBuild2DMipmaps" method. 
    [ testApp.cpp, line 122 ]

  4. The last operation is to switch the texture ID stored in the 3D model via the
    custom method "switchAllMaterialTextureID". In the genuine addon, it was 
    impossible to do that, for obvious consistency reasons :) 
    [ testApp.cpp, line 124 & 3DS/model3DS.cpp, line 685 ]

The README.txt contains the licence and a copy of the explanations here above.