Problem with loading models using CreateFromCMO.

Mar 11, 2015 at 2:52 AM

I use in my project a DirectXTK library and I load my 3D models thought function CreateFromCMO I have some models, that have the same verticles, but using different bitmaps. I noticed, that this library has some of cache error, because I have three models, that should have different colors, but they don't, they have colors of first loaded model. What is wrong? Can anybody help me?
Mar 11, 2015 at 5:19 AM
The texture/effect cache is based on the 'material' name in the model. If you want them to be different materials, you should use different names so you can keep the efficiency of shared shaders & textures.

Otherwise, you can disable the sharing on the EffectFactory or DGSLEffecFactory by calling this method before loading your models:
factory->SetSharing( false );
Marked as answer by walbourn on 3/10/2015 at 9:19 PM
Mar 11, 2015 at 7:34 PM
I have different names of materials in the models, but setting sharing on false works. I wonder, why I have this error. But thanks for help :)
Mar 12, 2015 at 6:56 PM
Try putting a break-point in the EffectFactory code and see what happens with the lookup. Let me know what you find!
Mar 12, 2015 at 8:09 PM
I put breakpoint in EffectFactory and I can only notice, that when I load similar models, but with different names of materials and cmo files, I see, that fuction CreateTexture doesn't run.
Mar 13, 2015 at 1:19 AM
Can you run the cmodump.cpp tool on a few of your .CMO files and put the results here?
Mar 14, 2015 at 8:23 PM
I cannot setup project with this file, can you give me complete vs project to run this program?
Mar 15, 2015 at 6:53 AM
Edited Mar 15, 2015 at 6:55 AM
Just run the "Developer Command Prompt" for VS 2012, 2013, or 2015, change to the directory where you have saved the cmodump.cpp file. Then type:
cl /EHsc cmodump.cpp
It will compile a cmodump.exe. You then run it as
cmodump filename.cmo