microsoft / DirectXTK

The DirectX Tool Kit (aka DirectXTK) is a collection of helper classes for writing DirectX 11.x code in C++

Home Page:https://walbourn.github.io/directxtk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rendering a model Tutorial - Meshconverter FAILED with an unspecified error

MasterDrake opened this issue · comments

Hi, I was reading the tutorial about how to load an render a model with this TK using the provided files and I run into this problem.
No matter what file I've tried or how many times I tried, it always fails at loading the .obj file with an unhelpful error (80004005)

image

According to the source code, it fails at the LoadFromOBJ function, where the WaveFrontReader doesn't read the vertices/indices:
(
if (wfReader.indices.empty() || wfReader.vertices.empty())
return E_FAIL;
)

But how and why?
What am I doing wrong?
I've tried with other .obj files as well with no luck...

Thanks for you time and sorry to bother you!

Using notepad, what does your cup._obj file contain?

It should be the contents here.

Retried multiple times but with no luck
I really don't know what's going on...

test.zip

I tried with these files, maybe you'll have a better luck
If it works, then something's wrong in my end
Otherwise I'm clueless

Thank you for your immediate response!

The data files work fine at least on my machine and the EXE is right...

There must be some kind of localization issue.

Can you build the meshconvert.exe from the source projects in the GitHub repo and run under the debugger with those command-line arguments?

I've already tried before this issue and I retried now, with no luck
image

You said that it works fine in your machine, I've tried with the same zip in a mini laptop I have with the same error.

Thank you for your help in debugging this issue.

Please step into the WaveFrontReader::Load method and see what kind of characters it's hitting as it processes through the file. I'm using wide-characters so I don't understand why it's locale sensitive, but I may be having unintended side-effects from the call to std::locale::global(std::locale("")); in MeshConvert.cpp.

It's a locale issue with WaveFrontReader.h. PR coming shortly.

Thanks so much for your help in debugging this!

Yes, you're right and amazing!
I commented out that line and now it works.
Bravo!!

Thanks for your help and time.

Fixed meshconvert in this microsoft/DirectXMesh@66451d1

Updating the rest of my command-line tools which set locale for localized error message strings.