I'm having some trouble with working directories with irrlicht.
For some satanic reason the working directory reported by:
Code: Select all
device->getFileSystem()->getWorkingDirectory();
Although for another satanic reason it can't open it if I say project-dir/data/cube.dae either. So that's fun!
So just to be clear:
Code: Select all
% pwd
/Users/isak/src/cpp/broccoli-boy
% ./who-will-laugh-at-broccoli-boy
Code: Select all
Starting game, prepare to poop pants
Ran with command: ./who-will-laugh-at-broccoli-boy
Irrlicht Engine version 1.8.1
Darwin Kernel Version 13.1.0: Wed Apr 2 23:52:02 PDT 2014; root:xnu-2422.92.1~2/RELEASE_X86_64
Using renderer: OpenGL 2.1
NVIDIA GeForce GT 750M OpenGL Engine: NVIDIA Corporation
OpenGL driver version is 1.2 or better.
GLSL version: 1.2
;;;; WORKING DIRECTORY: /Users/isak/src/cpp
Could not load mesh, because file could not be opened: : broccoli-boy/data/cube.dae
Code: Select all
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include "irrlicht/irrlicht.h"
//#include "allegro5/allegro.h"
#include "newton/Newton.h"
#define WINDOW_WIDTH 1920
#define WINDOW_HEIGHT 1080
using namespace std;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
int main(int argc, char **argv) {
cout << "Starting game, prepare to poop pants" << endl;
cout << "Ran with command: " << argv[0] << endl;
IrrlichtDevice *device = createDevice(EDT_OPENGL, dimension2d<u32>(WINDOW_WIDTH, WINDOW_HEIGHT), 32, false, true, true);
device->setWindowCaption(L"Who will laugh at broccoli boy?");
cout << ";;;; WORKING DIRECTORY: " << device->getFileSystem()->getWorkingDirectory().c_str() << endl;
if(!device) {
return EXIT_FAILURE;
}
// if(!al_init()) {
// return EXIT_FAILURE;
// }
IVideoDriver *video_driver = device->getVideoDriver();
ISceneManager *scene_manager = device->getSceneManager();
IMesh *cube = scene_manager->getMesh("broccoli-boy/data/cube.dae");
if (!cube) {
// al_uninstall_system();
device->drop();
return EXIT_FAILURE;
}
IMeshSceneNode *cube_node = scene_manager->addMeshSceneNode(cube);
if (cube_node) {
cout << "Halelujah" << endl;
cube_node->setMaterialFlag(EMF_LIGHTING, false);
}
scene_manager->addCameraSceneNode(0, vector3df(0, 0, -40), vector3df(0, 0, 0));
while(device->run()) {
video_driver->beginScene(true, true, SColor(100, 0, 0, 0));
//scene_manager->drawAll();
video_driver->endScene();
}
//al_uninstall_system();
device->drop();
return 0;
}
Like the topic suggests this is on mac os x.
When I've used other libraries ilke Allegro I have been able to reference paths like data/bla.png without any problems so it's not a general Mac OS X thing. But an irrlicht on Mac OS X thing.