[Tutorial] Getting started on Mac OS X
Well, it's getting quite more confusing:
It really seems to be a problem of finding the resource-files.
I tested three ways of starting the program:
--------------------------------------------------------------------------------------------
1st way: Terminal
The terminal says, that it cannot load the mesh (../Resources/sydney.md2) because the file could not be opend and leave me with a blank window.
--------------------------------------------------------------------------------------------
2nd way: Xcode
Starting the program with "Build&Run" out of Xcode, there is no terminal window (printf's are simply ignored?), the mesh loads up and is displayed but without any texture (white).
--------------------------------------------------------------------------------------------
3rd way: Double-click on the app in the Finder
Like the terminal method it gives a blank Irrlicht-window to me, but without the error messages in the terminal window.
--------------------------------------------------------------------------------------------
The most confusing fact at this problem is following:
As my app-file is a normal OS X Application, it is a package. If I open this package in the finder, I get the following file structur:
So "Irrlicht-Konfigurationstest.app" is my OS X appication, and therein "Irrlicht-Konfigurationstest" (in the MacOS folder) is the actual runable programfile. That's also the one I have to run in the terminal.
As you can see, the path "../Resources/sydney.md2" should be quite correct, reffering to my executable file in "MacOS".
I really don't understand what is wrong with it? Can anyone tell me what I am doing wrong? And why are there two ways of behaviour? If i start the program by clicking the build&run button in Xcode, the mesh is loaded correctly but without texture. If I start the program in the terminal or finder, nothing is loaded at all!?
:/ quite confusing!
It really seems to be a problem of finding the resource-files.
I tested three ways of starting the program:
--------------------------------------------------------------------------------------------
1st way: Terminal
The terminal says, that it cannot load the mesh (../Resources/sydney.md2) because the file could not be opend and leave me with a blank window.
--------------------------------------------------------------------------------------------
2nd way: Xcode
Starting the program with "Build&Run" out of Xcode, there is no terminal window (printf's are simply ignored?), the mesh loads up and is displayed but without any texture (white).
--------------------------------------------------------------------------------------------
3rd way: Double-click on the app in the Finder
Like the terminal method it gives a blank Irrlicht-window to me, but without the error messages in the terminal window.
--------------------------------------------------------------------------------------------
The most confusing fact at this problem is following:
As my app-file is a normal OS X Application, it is a package. If I open this package in the finder, I get the following file structur:
Code: Select all
Irrlicht-Konfigurationstest.app <Mac OS X Application File>
|
|__+ Contents <Folder>
|
|___ Info.plist <Property List>
|
|__+ MacOS <Folder>
| |
| |__ Irrlicht-Konfigurationstest <Executable>
|
|__PkgInfo <Plain Text>
|
|__+ Resources <Folder>
|
|__ sydney.md2 <MD2 Mesh>
|
|__ sydney.bmp <Windows/OS2 Bitmap>
|
|__ ... (other resources) <some other files>
As you can see, the path "../Resources/sydney.md2" should be quite correct, reffering to my executable file in "MacOS".
I really don't understand what is wrong with it? Can anyone tell me what I am doing wrong? And why are there two ways of behaviour? If i start the program by clicking the build&run button in Xcode, the mesh is loaded correctly but without texture. If I start the program in the terminal or finder, nothing is loaded at all!?
:/ quite confusing!
Hi,
ok, well, I've got a solution for loading files out of the application bundle, but the mesh is still white!
I took some Mac OS X-specific code (CFBundle) and loaded my resources from the bundle. My Sourcecode is now the following:
The Terminal says "Mesh loaded" and "Texture Loaded". The only problem is, that there is not texture loaded! -.-
still a white mesh.
what should I do?
ok, well, I've got a solution for loading files out of the application bundle, but the mesh is still white!
I took some Mac OS X-specific code (CFBundle) and loaded my resources from the bundle. My Sourcecode is now the following:
Code: Select all
#include <OpenGL/OpenGL.h>
#include <Carbon/Carbon.h>
#include <CoreFoundation/CFBundle.h>
#include <CoreFoundation/CFString.h>
#include <irrlicht.h>
#include <iostream>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "libIrrlicht.a")
// function provides some Mac OS X specific source code to load files from the resources of the application bundle.
char * resPath(char **argv, char* name, char* type )
{
char resource[1024];
CFURLRef cfBundleURL = CFBundleCopyResourceURL( CFBundleGetMainBundle(),
CFStringCreateWithCString(kCFAllocatorDefault,
name,
kCFStringEncodingISOLatin1),
CFStringCreateWithCString(kCFAllocatorDefault,
type,
kCFStringEncodingISOLatin1),
NULL );
CFStringGetCString( CFURLCopyPath(cfBundleURL),
resource,
1023,
kCFStringEncodingISOLatin1);
return resource;
}
int main(int argc, char** argv)
{
IrrlichtDevice *device = createDevice(EDT_OPENGL,
dimension2d<s32>(512, 384),
16,
false,
false,
false,
0);
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IAnimatedMesh* mesh = smgr->getMesh( resPath(argv, "sydney", "md2") );
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setFrameLoop(0, 310);
// -- PROBLEM -- Irrlicht still displays just a white mesh without texture!
node->setMaterialTexture( 0, driver->getTexture( resPath(argv, "sydney", "bmp") ));
}
smgr->addCameraSceneNode(0,
vector3df(0,30,-40),
vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true,
true,
SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
still a white mesh.
what should I do?
Fareusel, do you have a copy of Zathras' tutorial? The link posted here:
http://www.ruthless.zathras.de/facts/ap ... on-mac.php
seems to be dead. I'm really interested in checking how he setup things to compile a new project.
I've also added everything as described here but without any success, so any extra info will come in handy
regards,
Alvaro
ps. If anyone else has got a copy of this tutorial, please post it here
http://www.ruthless.zathras.de/facts/ap ... on-mac.php
seems to be dead. I'm really interested in checking how he setup things to compile a new project.
I've also added everything as described here but without any success, so any extra info will come in handy
regards,
Alvaro
ps. If anyone else has got a copy of this tutorial, please post it here
at first sorry for bumping this old topic.
i followed the tutorial, with some necessary changes and my project is compiling, giving me a static grey screen and freezing my mouse cursor till i fquit the app., instead of displaying the obj. i was expecting.
anyone experience the same problem - has a possible solution?
forgot to add, i am running xcode 3.2.1 on snow leopard.
thanks a lot
i followed the tutorial, with some necessary changes and my project is compiling, giving me a static grey screen and freezing my mouse cursor till i fquit the app., instead of displaying the obj. i was expecting.
anyone experience the same problem - has a possible solution?
forgot to add, i am running xcode 3.2.1 on snow leopard.
thanks a lot
If you just drag jpeg into your project, it ends up in the Resources folder once you build and run. Hence why the Resources folder should be included in the default folder archives. Bitplane was supposed to have added this already. You shouldn't need a special function resPath or have to specify a path to the resources folder.
I cannot run the examples on OSX
Hi,
I am trying to get the examples work without success, I can compile the lib and the examples but when try to run it nothing happen, the shell don't log nothing so I have not idea of what is happening, I am new on Xcode so may be I am missing something, any help?
OSX 10.6.4 Xcode 3.2.2
thanks!
I am trying to get the examples work without success, I can compile the lib and the examples but when try to run it nothing happen, the shell don't log nothing so I have not idea of what is happening, I am new on Xcode so may be I am missing something, any help?
OSX 10.6.4 Xcode 3.2.2
thanks!
I'm still trying to get it to work, bu I found one-
http://karlkirch.com/blog/2010/03/10/irrlicht-xcode/
http://karlkirch.com/blog/2010/03/10/irrlicht-xcode/
Re: [Tutorial] Getting started on Mac OS X
Hello.. osxus3r
Are you still in this forum?..
It's been several years since you have posted this thread.
I hope you to write again for iPad app in Xcode 4 or Xcode 3.2.6 ..
There are quite much needs for simple and fast 3d engine in iOS programming.
Regards
Are you still in this forum?..
It's been several years since you have posted this thread.
I hope you to write again for iPad app in Xcode 4 or Xcode 3.2.6 ..
There are quite much needs for simple and fast 3d engine in iOS programming.
Regards
Re: [Tutorial] Getting started on Mac OS X
Heya everyone,
Thought I would just post the steps I used to get a new project up in XCode 4.1, seeing how its substantially different from the older version!
Note that I had to compile irrlicht myself to get the static library first before I could do this. (I managed to compile it from 1.7.2 base, check out http://irrlicht.sourceforge.net/forum/v ... =1&t=44736
Anyway to start:
Thought I would just post the steps I used to get a new project up in XCode 4.1, seeing how its substantially different from the older version!
Note that I had to compile irrlicht myself to get the static library first before I could do this. (I managed to compile it from 1.7.2 base, check out http://irrlicht.sourceforge.net/forum/v ... =1&t=44736
Anyway to start:
- Create a new empty project.
- Add a target. (You can do this by left clicking the project file in the tree menu on the left, then look for a circle with a plus at the bottom of the window)
- Select Max OS X > Application > Cocoa Application
- Now delete the *AppDelegate.m, *AppDelegate.h and *.xib file, you wont need these.
- Now create a new file
- I usually select Mac OS X > C and C++ > C++ File. I also usually fill it with the Example 1 tutorial to get the app compiling with some output to start.
- Now click on the project in the left tree menu again
- In the central part of the screen, click "Build Settings", and change the following settings:
- Base SDK: Standard (32/64 bit intel)
- Base SDK: Latest Mac OS X
- Compiler for C/C++/Objective-C: LLVM GCC 4.2
- Header Search Paths: /Path/To/Your/Irrlicht/Folder/include
- Now select "Build Phases"
- Under "Link Binary With Libraries, click the plus and add Cocoa, Carbon, IOKit, OpenGL, and the libIrrlicht.a file.
- under "Compile Sources", select the 'main.m' and then delete the main.m file
- Compile!
-
- Posts: 1
- Joined: Mon Feb 11, 2013 11:05 am
Re: [Tutorial] Getting started on Mac OS X
Hi, I have been struggling for a a little while to find out the right command to compile an irrlicht file from command line once installed using the tutorial [1]. So I figured I would share it :
Packaging it as a MacOS app avoid trouble with catching keyboard input.
You must of course have created the folder MyApp.app/Contents/MacOS beforehand
Hope it helps some people.
I think I would be nice to have this on the front page.
[1] http://irrlicht3d.org/wiki/index.php?n= ... uildMacOSX
Code: Select all
g++ -o MyApp.app/Contents/MacOS/MyApp myfile.cpp -fvisibility=hidden -lirrlicht -framework Foundation -framework OpenGL -framework Cocoa -framework Carbon -framework AppKit -framework IOKit
You must of course have created the folder MyApp.app/Contents/MacOS beforehand
Hope it helps some people.
I think I would be nice to have this on the front page.
[1] http://irrlicht3d.org/wiki/index.php?n= ... uildMacOSX