Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Update ofxAssimpModelLoader.cpp #2830

Merged
merged 1 commit into from

3 participants

ed-was-here Christoph Buchner arturo
ed-was-here

fixes issue #1932 - ofxAssimpModelLoader example fails on Windows when loading 3DS model (when pressing '5')
Models were being loaded in text mode instead of binary mode causing issues with binary formats like .3ds.

ed-was-here ed-was-here Update ofxAssimpModelLoader.cpp
Load models in binary, not text mode.  fixes issue #1932 - ofxAssimpModelLoader example fails when loading 3DS model (when pressing '5')
aac4078
arturo arturoc merged commit d2a235d into from
Christoph Buchner
Owner

so, @arturoc, is it ok to load text files in binary mode, on every platform?

arturo
Owner

yes it's ok, indeed we should have binary mode as default, libraries shouldn't care about breaklines being \n or \r\n when reading text files and if you are reading a unix text file in windows or viceversa then it's more obvious that you need to set not binary mode, we could even change the name of that parameter to convertBreaklines since that's all it does and binary is kind of confusing

Christoph Buchner
Owner

still, it's common parlance, and the fstream parameter is also called (ios::)binary, so I'd rather keep it that way, to increase the probability of finding information about it on the net.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2014
  1. ed-was-here

    Update ofxAssimpModelLoader.cpp

    ed-was-here authored
    Load models in binary, not text mode.  fixes issue #1932 - ofxAssimpModelLoader example fails when loading 3DS model (when pressing '5')
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp
2  addons/ofxAssimpModelLoader/src/ofxAssimpModelLoader.cpp
View
@@ -17,7 +17,7 @@ ofxAssimpModelLoader::~ofxAssimpModelLoader(){
//------------------------------------------
bool ofxAssimpModelLoader::loadModel(string modelName, bool optimize){
- file.open(modelName);
+ file.open(modelName, ofFile::ReadOnly, true); // Since it may be a binary file we should read it in binary -Ed
if(!file.exists()) {
ofLogVerbose("ofxAssimpModelLoader") << "loadModel(): model does not exist: \"" << modelName << "\"";
return false;
Something went wrong with that request. Please try again.