Could not load mesh on OS X

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Shenk
Posts: 1
Joined: Fri Jul 29, 2016 12:59 pm

Could not load mesh on OS X

Post by Shenk »

Hello

I just downloaded Irrlicht and created a project using cmake that contains the 01.HelloWorld code. I copied the media directory into my project directory (which is also the running directory) and edited the mesh loading path to "media/sydney.md2".

For some reason, Irrlicht says "Could not load mesh, because file could not be opened: : media/sydney.md2".

This shouldn't be a path issue since I can open "media/sydney.md2" using the exact same path and display its contents in the same program:

Code: Select all

 
std::string line;
std::ifstream myfile ("media/sydney.md2");
if (myfile.is_open())
{
    while (std::getline (myfile,line) )
    {
        std::cout << line << '\n';
    }
    myfile.close();
}
 
else std::cout << "Unable to open file";
 
The part above correctly outputs the file's contents, however

Code: Select all

 
IAnimatedMesh* mesh = smgr->getMesh("media/sydney.md2");
 
fails and says "Could not load mesh, because file could not be opened: : media/sydney.md2".

This correctly displays the file's contents. Does anyone know what the problem might be?

Thank you.
RungAaz
Posts: 11
Joined: Sat Jun 19, 2010 9:18 am

Re: Could not load mesh on OS X

Post by RungAaz »

Sorry, the following post doesn't really apply to your case ...

Hey, maybe you are either including or not including the "exampleHelper.h" header file.
In the header file it may alter some base path, which may cause your issue.

Here are the contents of that file, maybe that helps:

Code: Select all

 
// Copyright (C) 2015 Patryk Nadrowski
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
 
#ifndef __EXAMPLE_HELPER_H_INCLUDED__
#define __EXAMPLE_HELPER_H_INCLUDED__
 
#include "IrrCompileConfig.h"
#include "path.h"
 
namespace irr
{
 
static io::path getExampleMediaPath()
{
#if defined (_IRR_IPHONE_PLATFORM_) || defined (_IRR_ANDROID_PLATFORM_) || defined (_IRR_OSX_PLATFORM_)
    return io::path("media/");
#else
    return io::path("../../media/");
#endif
}
 
} // end namespace irr
 
#endif
 
 
[/size]
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Could not load mesh on OS X

Post by mongoose7 »

Check the console output.
Post Reply