Page 1 of 10

Compiling irrlicht ogl-es branch for iphone (progress)

Posted: Sat Jun 20, 2009 2:09 am
by wildrj
Hello everyone im trying to get the ogl-es branch compiling for iphone i have gotten pretty far and ill explain each step taken to get were im at but im stuck on two errors ill explain up to the errors.

1. Create a new basic iphone project in xcode. (Window-Based application)

2. Add the irrlicht source and include folder to your project

3. Open the irrCompileConfig.h in the include folder and go to line 75.
copy

Code: Select all

#define _IRR_IPHONE_PLATFORM_
and

Code: Select all

#define _IRR_USE_IPHONE_DEVICE
anywere out of that #if statement

4. When you get a error stating irrType.h not found go to that file and change <irrType.h> to "irrType.h". (i dont remember what file)

5. Go to CIrrDeviceIPhone.cpp and go to line267 and delete namespace base{ and find the corrisponding }. do not delete the code inside it just the encapsulation.

6.Click Project->ActiveTarget and add the opengl and opengles frameworks.

7. Download libpng, libjpeg, and libzlib. Compile them and copy libjpeg.a, libz.a,libpng.dylib to your project.

8. Your at the errors im at now.

I do not know how to solve the errors im at hopefully someone who has gotten it to compile knows the solution.

Code: Select all

".objc_class_name_CAEAGLLayer", refrenced from: literal-pointer@__OBJC@__cls_refs@CAEAGLLayer in CIrrDeviceIPhone-DC9863AF.o

"_createDeviceEx", refrenced from: _createDevice in Irrlicht.o symobls not found collect2:ld returned 1 exit status
Ive gotten this far any suggestions?

Posted: Mon Jun 22, 2009 8:20 am
by noster
I had this error as well. If I remember correctly it is caused by the Obj-C++ linking process so simple

Code: Select all

extern "C"  {

    // createDeviceEx code here

};
around createDeviceEx method in CIrrDeviceIPhone.cpp should suffice.

Posted: Tue Jun 23, 2009 2:13 am
by wildrj
ONE LAST ERROR GUYS! JUST ONE!

".objc_class_name_CAEAGLLayer", refrenced from:
literal-pointer@__OBJC@__cls_refs@CAEAGLLayer in CIrrDeviceIPhone-DC9863AF.o
symbols not found
collect2:id returned 1 exist status


Come on if someone knows how to slove this last one.. ill upload a working copy that works with the iphone :)

Posted: Tue Jun 23, 2009 2:21 am
by zibba
Try adding the QuartzCore.Framework

(first post, hi!)

Posted: Tue Jun 23, 2009 3:15 am
by wildrj
THANK YOU zibba!!!

Alright so we got it finnaly compiling in both 2.2.1 and 3.0...next step is actually getting it to render anything .. Gotta wait on that till i get this compiled source to my partner. Dont worry i will upload the working source.. here is the last bit of intsructions for anyone trying to do it themselfs.


1.Go into COSOOperator.. and take out any ifdef regarding OSXClipBoard
2. open CIRRDeviceIphone.cpp and put

extern "C" {

// createDeviceEx code here

};

around the createDeviceEx

3. Add teh quartzCore framework

And it should compile. Not sure if it works yet but...umm progress.

Posted: Tue Jun 23, 2009 3:26 am
by zibba
most excellent! please let me know as soon as you have something rendering!

Posted: Tue Jun 23, 2009 7:28 am
by FuzzYspo0N
This is fighting an already fought battle guys :) Seeing this post yesterday i sent hybrid the stuff to release (even though it isnt perfect yet).

Keep an eye out for hybrids post/update on the iphone version, it has a working xcode project and is rendering/deployable on iphone.

(and you can blame my perfectionism for the delays, i wanted it to work out of the box). The reason i didnt see such urgent rush is that a) you need an adc account to even hope for seeing it on a device and b) the xcode project issues are a large amount of fun, but i reduced them significantly so have fun :C . feel free to ask questions about the xcode errors , i know them out of the back of my mind already :/

Posted: Tue Jun 23, 2009 7:52 pm
by noster
We know, but as the results of the battle aren't published yet we just fought on our own. Separately ;)

Now when you've sent your code to Hybrid I hope we could put it to some good use. [doing svn up on second mind thread]. I'll wait now and polish previous project before digging into it.

Thanks for your hacking.

Posted: Tue Jun 23, 2009 9:26 pm
by wildrj
So with fuzzyspoons version when trying to compile i get conflicting opengl types..... then with a precompiled version i was sent.. i get a _createDeviceEx" unrefrenced error.... from irrlichtApplication::InitApplication()

DOES IT EVER END!

Posted: Wed Jun 24, 2009 2:35 am
by Zenja
This morning I started playing with the iPhone/OpenGLES1.1 branch for the very first time, and managed to compile Irrlicht and Example1 without too much tinkering. However, it will crash in irrAllocated during the run loop, which I narrowed down to MaxTextureUnits being 8. Setting it to 2, and Irrlicht run loop iterates, but nothing is displayed on the screen.

Trying to figure this one out, but it seems as if no view is attached to the window (WindowID = 0). If anyone has any suggestions, I'm all ears (in this case, eyes :)

Posted: Wed Jun 24, 2009 7:15 am
by FuzzYspo0N
Thats right zenja, there is no view / window attached.

Seeing as the irrlicht is the main focus on being "publicly working" this will benefit a lot of people too.

Code: Select all

http://www.mediafire.com/file/i1juyzy3mzz/iPhoneTemplateApp.zip
That is an empty application template and xcode project that will build with the correct lib files from the irrlicht stuff. If you can build libs, you ca take a stab at getting it to work (in terms of silly issues like, debug lib with debug version of app, simulator/device issues etc).

EDIT : changed the profiles in the project.
Though i left these in for reference, oh well ;p

Posted: Wed Jun 24, 2009 11:11 am
by hybrid
I'm still out of luck for this one. As you might have noticed, I was able to build the OSX versions in the branch now (commited some code yesterday), but only with some more local hacking. Didn't succeed in anything for the iPhone stuff, but I'm at it.

Posted: Wed Jun 24, 2009 6:06 pm
by FuzzYspo0N
Im still able to build and compile mine, ill send you the newer stuff iv done later tonight hybrid. Hopefully that will help.

Posted: Wed Jun 24, 2009 10:07 pm
by Zenja
FuzzySpoon, thanks for the template code (very well documented, thank you). Worked like a charm after a complete rebuilt, and I can now run Irrlicht on the simulator and on the device.

I've previously written my own OpenGL based game engine from scratch which I've used for a couple of commercial products for the iPhone, the latest being Embargo (http://www.zenyes.com for screenshots and gameplay video). From a graphics perspective, my engine lacks a lot of features which Irrlicht has. On the plus side, I've added quite a few features a iPhone game engine needs:
- Freetype fonts via FTGL, modified for GLES.
- PVRTextureCompression via Oolong
- Alpha sorted branch in scene graph which works well with tile based renderer.
- iPhone platform support (touches/accelerator/rendering thread (20% speed boost), cross platform locks, message ports, etc)
- Landscape orientation (90 rotation) - quite a number of changes to camera, skydomes, input processing etc. are needed for Landscape orientation.
- All 2D elements use percentage based positions, so it looks the same at 1680x1050 and 320x480 or 480x320.
- OpenAL and OggVorbis stream support.
- cross platform, so all development done under Visual Studio, while final testing done on device.
- tuned for OpenGL ES1.1
- custom physics engine
- etc
The biggest problem for my engine is that although fast, it lacks many graphic features which exist in more mature engines.

My next project needs a heavier physics engine, so I'm going to use Bullet. However, the most efficient way of informing the physics engine about the game world would be to use a BSP based enviroment (which Bullet supports), but my engine doesn't. I'm getting tired of constantly reinventing the wheel and adding new features to my engine all by myself. Yes, I've learned a lot, but at the end of the day, I've realised that my from scratch engines end up having an almost identical design to existing mature engines (eg. its scary how similar to Bullet my physics component is, and I share a lot of common design with Irrlicht). I alone cannot keep up with what teams of excellent developers are creating. So I've decided to investigate graphics engines and see which community to join, and where to add my contributions. Irrlicht just seems to be the best option for the moment, especially with a planned GLES2.0 code path.

Having said all that, a lot of features I'm going to port from my game engine to a new engine are at the moment iPhone specific. I dont see Irrlicht inheriting PVRTC, or freetype for fonts, or accelerometer/multitouch input. There are however quite a number of OpenGL/GLES optimisations which I've identified which I can backport to the engine I'll end up using.

Posted: Wed Jun 24, 2009 11:13 pm
by hybrid
TrueType fonts can be used with Irrlicht, even though it needs an add-on. That's not hard, but it might even be integrated into the engine in the future.
Compressed textures are being worked on, even though indexed textures will be first.
Why does the scene needs alpha ordering, I thought that tile based rendering does no sorting at all? Irrlicht sorts in order to reduce render state changes, which is the most important for tile based rendering.
Landscape works for Irrlicht automatically, all necessary setups have an easy interface. 2D elements have alignment options, which will help for the automatic layout.