Tuesday, November 14, 2006

Porting irrlicht to Symbian platform.


Recently, I'm trying to port a popular open-source graphics engine irrlicht onto mobile platforms. The first target is nokia's S60. Some preliminary results have been achieved. Have a look! (Screen shot, Video clip).

Latest source code can be download here with a subversion client tool. The trunk contains the ported code and synced with revision 301(13.11.2006) of the sourceforge svn depot of irrlicht. A sync branch under "branches" serves as a bridge for merging with the irrlicht depot. In the directory "source/irrlicht", there are two symbian projects generated by CarbideVS. The first one is mirrlicht(the directory name is Symbian), which contains irrlicht compiled as a dll and a helloworld example exe. It currently doesn't work (simply crashes the emulator) since I haven't figured out how to use dlls on Symbian platform. The second one is symbirrlicht. It's compiled as a monolithic exe consisting of the ported irrlicht source code and the hello world sample code. The screenshot and videos are generated by this project.

Since no STL is used in irrlicht and the software structure also lends itself to easy extending, the porting goes rather smoothly. I've spent only several days before getting the first results (including fighting with Symbian dev platform coz I'm a newbie of it) .

The following outlines some important points for the porting.

1.COpenGLDriver.cpp

This is key component for the porting to work. Because OpenGL ES 1.1 doesn't support glBegin/glEnd, glVertex commands, I have to replace some 2D rendering code with glDrawElements. Some other unsupported features like glPushAttrib/glPopAttrib, Texcoord generation needs workarounds or completely disable.

2.COpenGLTexture.cpp

Reversed color formt like A1R5B5G5 is not supported by OpenGL ES, so we have to convert the image data to normal order.

3.In image and 3D model loading code, the compiler directives for byte alignment needs to be adapted for Symbian. (All of them actually are the same, maybe later this could be refactored to a common place to facilitate porting to other systems.)

4.Add a new irrDevice -- irrDeviceSymbian.
The cursorcontrol and event handling has been completely disabled.


2 comments:

Ed Welch said...

I'm interested in porting irrlicht to symbian too. But the source code no londer seems to be available:

Error: Error while performing action: URL 'http://mirrlicht.googlecode.com/svn/trunk/mirrlicht-read-only' doesn't exist

Unknown said...
This comment has been removed by the author.