Irrlicht on Windows Mobile 5 [in progress, help needed]
Irrlicht on Windows Mobile 5 [in progress, help needed]
Hi, I'm developing a multi-platform networked game for a school project. One of the platforms happens to be a Pocket PC under Windows Mobile 5 (WM5), and I was wondering how feasible it is to run Irrlicht on it:
- Would performance be enough to run very basic 3D in software? (Low Poly, small textures, no dynamic lights)
- [solved] There is a project to compile for Windows Mobile 6 (WM6), but is it realistic to compile for WM5? Or does that require massive code changes to be functional? (Keep in mind I never programmed for a mobile device.)
Trying to answer my own questions, I managed to do the following things:
- [See post below] Edited the .vcproj file for Windows Mobile 6 (as is, it won't open in VS2005), and simply changed the platform string to the appropriate one for WM5. Result: it compiles fine (with two redefined macros warnings) and generates Irrlicht.dll
- [See post below] Started a new Visual Studio 2005 console app project targetting WM5, and copy-pasted the code for the Hello World app (that displays the Sydney model) with very few changes (only windows size and file path). I used the release Irrlicht dll I compiled earlier. Result: it runs and displays the text box; and I successfully added a button as well.
Problem: loading the md2 consistently fails, as well as any attempt to load a texture. Sydney.bmp and Sydney.md2 are on the PDA in the same folder as the application, but even with an absolute path (WM5 doesn't have drive letters or a current directory, apparently), loading fails.
Example path: "\\Program Files\\testIrrlicht\\Sydney.bmp"
Overall this is taking a lot of time, and I would appreciate some answers to my first questions. As well, I'd be immensely grateful if someone could provide me with a Hello World app that's known to deploy and run correctly on Windows Mobile.
Thanks in advance!
Edit: The topic was moved! And I thought this was a begginer's question .
- Would performance be enough to run very basic 3D in software? (Low Poly, small textures, no dynamic lights)
- [solved] There is a project to compile for Windows Mobile 6 (WM6), but is it realistic to compile for WM5? Or does that require massive code changes to be functional? (Keep in mind I never programmed for a mobile device.)
Trying to answer my own questions, I managed to do the following things:
- [See post below] Edited the .vcproj file for Windows Mobile 6 (as is, it won't open in VS2005), and simply changed the platform string to the appropriate one for WM5. Result: it compiles fine (with two redefined macros warnings) and generates Irrlicht.dll
- [See post below] Started a new Visual Studio 2005 console app project targetting WM5, and copy-pasted the code for the Hello World app (that displays the Sydney model) with very few changes (only windows size and file path). I used the release Irrlicht dll I compiled earlier. Result: it runs and displays the text box; and I successfully added a button as well.
Problem: loading the md2 consistently fails, as well as any attempt to load a texture. Sydney.bmp and Sydney.md2 are on the PDA in the same folder as the application, but even with an absolute path (WM5 doesn't have drive letters or a current directory, apparently), loading fails.
Example path: "\\Program Files\\testIrrlicht\\Sydney.bmp"
Overall this is taking a lot of time, and I would appreciate some answers to my first questions. As well, I'd be immensely grateful if someone could provide me with a Hello World app that's known to deploy and run correctly on Windows Mobile.
Thanks in advance!
Edit: The topic was moved! And I thought this was a begginer's question .
Last edited by gabba on Fri Jan 30, 2009 12:17 pm, edited 3 times in total.
Well... no answers. Hopefully if I report my latests efforts I'll get some attention .
Summary of this post:
A. Bug fix! My contribution to Irrlicht
B. Remaining (horrible) bugs
C. Information to reproduce the bug(s)
A.
I didn't manage to run the app with the debug .DLL on the Pocket PC emulator, it kept telling me "wrong Windows version". In the end I created a new project and statically linked Irrlicht into my test app, to be able to debug it.
This finally allowed me to solve one of my problems. I fixed a bug in Irrlicht 1.5 which makes loading any file impossible under Windows Mobile or CE !! That's why loading models and textures failed.
The faulty code is this method in CFileSystem.cpp:
When under Windows CE/Mobile, only the first and last line are executed, so the function does the following, which erases the file path:
Naturally this prevents any file to load. What I did to fix this is to return directly the filename parameter, since pathnames are always absolute on windows Mobile/CE:
Corrected code, the changes are at the end:
B.
Now for the bad news:
- I get an access violation whenever I attempt to load Sydney.md2. I assume it's because of a lack of memory, since the model is pretty big with all those animation frames, and there's little memory on a PocketPC. Still, shouldn't this be treated more gracefully?
- I replaced Sydney by ninja.b3d, the smallest model file I could find in the /media folder. This time, the model displays and animates, but it's all black. Its texture (the blue ninja one) is not displayed, even though debugging shows that the file is found, and I can display 2D images (such as the Irrlicht logo .tga with transparency) fine.
- If I set the camera close enough to the model (so it almost fills the screen), the ninja goes through a few animations, and then the program crashes with an access violation, always on the following line of CTRTextureGouraud2.cpp:
The access violation is due to z being a pointer to forbidden memory.
I've tried disabling/enabling some features such as Z Buffer, but this just produces an access violation elsewhere. The crash always seems to happen when part of the ninja model moves out of the window, or when the ninja jumps away from the camera (positioned below him).
C.
If you want to help solve the bugs and perfect the Irrlicht WindowsCE/Mobile port, here are the resources:
- You need Visual Studio 2005 SP1 (I'm running this under Windows XP SP3)
- Install the Windows Mobile 5.0 SDK and ActiveSync 4.5
- Start an empty project targeting Windows Mobile 5.
- Add all the source and header files from Irrlicht 1.5 in your project, and add the Source and Source\zlib folders to your additional include directories.
- To statically link Irrlicht into your app, you need to set the following preprocessor definitions in the project properties:
- The code for the test program is the following, put it in a new .cpp file:
- Play with the deployment options in the project properties (as well as the file paths in the test app code) to make sure that ninja.b3d and nskinbl.jpg are deployed in the same folder as your app on the Pocket PC emulator.
- Compile, deploy and run! You'll soon get the crash, but you can avoid it by putting the camera position further away from the model.
- Post your results and bug fixes in this thread.
Summary of this post:
A. Bug fix! My contribution to Irrlicht
B. Remaining (horrible) bugs
C. Information to reproduce the bug(s)
A.
I didn't manage to run the app with the debug .DLL on the Pocket PC emulator, it kept telling me "wrong Windows version". In the end I created a new project and statically linked Irrlicht into my test app, to be able to debug it.
This finally allowed me to solve one of my problems. I fixed a bug in Irrlicht 1.5 which makes loading any file impossible under Windows Mobile or CE !! That's why loading models and textures failed.
The faulty code is this method in CFileSystem.cpp:
Code: Select all
core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
{
c8 *p=0;
#ifdef _IRR_WINDOWS_API_
#if !defined ( _WIN32_WCE )
c8 fpath[_MAX_PATH];
p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
#endif
#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
c8 fpath[4096];
fpath[0]=0;
p = realpath(filename.c_str(), fpath);
if (!p)
{
// content in fpath is undefined at this point
if ('0'==fpath[0]) // seems like fpath wasn't altered
{
// at least remove a ./ prefix
if ('.'==filename[0] && '/'==filename[1])
return filename.subString(2, filename.size()-2);
else
return filename;
}
else
return core::stringc(fpath);
}
#endif
return core::stringc(p);
}
Code: Select all
c8 *p=0;
return core::stringc(p);
Corrected code, the changes are at the end:
Code: Select all
core::stringc CFileSystem::getAbsolutePath(const core::stringc& filename) const
{
c8 *p=0;
#ifdef _IRR_WINDOWS_API_
#if !defined ( _WIN32_WCE )
c8 fpath[_MAX_PATH];
p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
#endif
#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
c8 fpath[4096];
fpath[0]=0;
p = realpath(filename.c_str(), fpath);
if (!p)
{
// content in fpath is undefined at this point
if ('0'==fpath[0]) // seems like fpath wasn't altered
{
// at least remove a ./ prefix
if ('.'==filename[0] && '/'==filename[1])
return filename.subString(2, filename.size()-2);
else
return filename;
}
else
return core::stringc(fpath);
}
#endif
#ifdef _WIN32_WCE
return filename; //unmodified, since WinCE only uses absolute pathnames
#else
return core::stringc(p);
#endif
}
Now for the bad news:
- I get an access violation whenever I attempt to load Sydney.md2. I assume it's because of a lack of memory, since the model is pretty big with all those animation frames, and there's little memory on a PocketPC. Still, shouldn't this be treated more gracefully?
- I replaced Sydney by ninja.b3d, the smallest model file I could find in the /media folder. This time, the model displays and animates, but it's all black. Its texture (the blue ninja one) is not displayed, even though debugging shows that the file is found, and I can display 2D images (such as the Irrlicht logo .tga with transparency) fine.
- If I set the camera close enough to the model (so it almost fills the screen), the ninja goes through a few animations, and then the program crashes with an access violation, always on the following line of CTRTextureGouraud2.cpp:
Code: Select all
#ifdef CMP_W
if ( line.w[0] >= z[i] )
#endif
I've tried disabling/enabling some features such as Z Buffer, but this just produces an access violation elsewhere. The crash always seems to happen when part of the ninja model moves out of the window, or when the ninja jumps away from the camera (positioned below him).
C.
If you want to help solve the bugs and perfect the Irrlicht WindowsCE/Mobile port, here are the resources:
- You need Visual Studio 2005 SP1 (I'm running this under Windows XP SP3)
- Install the Windows Mobile 5.0 SDK and ActiveSync 4.5
- Start an empty project targeting Windows Mobile 5.
- Add all the source and header files from Irrlicht 1.5 in your project, and add the Source and Source\zlib folders to your additional include directories.
- To statically link Irrlicht into your app, you need to set the following preprocessor definitions in the project properties:
Code: Select all
_IRR_STATIC_LIB_
_DEBUG
_WIN32_WCE=$(CEVER)
UNDER_CE
$(PLATFORMDEFINES)
WINCE
DEBUG
_WINDOWS
$(ARCHFAM)
$(_ARCHFAM_)
_UNICODE
UNICODE
NO_GETENV
_CRT_SECURE_NO_DEPRECATE
Code: Select all
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(linker, "/subsystem:WINDOWSCE /ENTRY:main")
int main()
{
IrrlichtDevice *device =
createDevice( video::EDT_BURNINGSVIDEO, dimension2d<s32>(200, 200), 16,
false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!",
rect<s32>(10,10,100,22), true);
IAnimatedMesh* mesh = smgr->getMesh("\\Program Files\\HelloWorld_mobile5\\ninja.b3d");
if (!mesh)
return 1;
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setAnimationSpeed(15);
ITexture * texture = driver->getTexture("\\Program Files\\HelloWorld_mobile5\\nskinbl.jpg");
node->setMaterialTexture( 0, texture);
}
smgr->addCameraSceneNode(0, vector3df(0,-5,5), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
- Compile, deploy and run! You'll soon get the crash, but you can avoid it by putting the camera position further away from the model.
- Post your results and bug fixes in this thread.
-
- Posts: 66
- Joined: Wed Oct 04, 2006 2:07 pm
Greetings!
Windows Mobile as gabba already did compiles on pocketpc 2003 with evc4.
It's really just modifying the target platform.
For the crashes, i guess theses are memory issues.
For the Filesystem, yep, smth has to be done. ( the new absolutePath problem arises in b3d loader ).
i extended the windows mobile example to use the helloworld, custom scene node and the terrain example in one executable. all are running on my machine.
It can be usefull to build a 3d game with irrlicht on a windows mobile. but you have to downgrade and choose carefully what you will support.
Biggest problem is fpu. a machine without fpu can't really use irrlicht.
software rendering also needs the fpu.
Irrlicht is not really build for low memory situations.
My target machine is an old HTC, which doesn't support anything and is really slow. more than 5-12 fps i never get with a real example. even with the fastest software rendering settings. nikos software renderer is faster here. but it doesn't clip;-)
Bye tom
Windows Mobile as gabba already did compiles on pocketpc 2003 with evc4.
It's really just modifying the target platform.
For the crashes, i guess theses are memory issues.
For the Filesystem, yep, smth has to be done. ( the new absolutePath problem arises in b3d loader ).
i extended the windows mobile example to use the helloworld, custom scene node and the terrain example in one executable. all are running on my machine.
It can be usefull to build a 3d game with irrlicht on a windows mobile. but you have to downgrade and choose carefully what you will support.
Biggest problem is fpu. a machine without fpu can't really use irrlicht.
software rendering also needs the fpu.
Irrlicht is not really build for low memory situations.
My target machine is an old HTC, which doesn't support anything and is really slow. more than 5-12 fps i never get with a real example. even with the fastest software rendering settings. nikos software renderer is faster here. but it doesn't clip;-)
Bye tom
burningreggae
-
- Posts: 24
- Joined: Sun Sep 23, 2007 9:45 pm
- Location: Spain
I have to test the mobile version of Irrlicht 1.5. I have been using the port of rendermania:
http://graphicsmakesfun.blogspot.com/20 ... lator.html
I will compare the two versions.
The problem in this devices, as burningwater comments, is the FPU if we want a fast rendering we need a fixed point maths, that i think is a very hard work...
http://en.wikipedia.org/wiki/Fixed_point_(mathematics)
http://graphicsmakesfun.blogspot.com/20 ... lator.html
I will compare the two versions.
The problem in this devices, as burningwater comments, is the FPU if we want a fast rendering we need a fixed point maths, that i think is a very hard work...
http://en.wikipedia.org/wiki/Fixed_point_(mathematics)
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Are there any WinCE devices which have OpenGL-ES support? I always thought that WinCE would imply some kind of DirectX if one wants HW acceleration. And I didn't knew about any recent versions of mirrlicht at all. But since we now also have an OpenGL-ES driver (in the branch ogl-es) we might merge that version back in order to lower the redundancy and fix issues with the drivers. Do you know whom to contact for mirrlicht?
-
- Posts: 66
- Joined: Wed Oct 04, 2006 2:07 pm
I don't know of any real windows mobile device with 3d hardware acceleration. mirrlicht is S60 port, focused on 3d-hardware with opengl-es which some phones have. i just had a look to the website. he is active again! but i never talked with him.
i doesn't matter if opengl-es would exists, without a fpu it's rather useless.
So, iPhone is a much better candiate.
Have a look at EdgeLib ( www.edgelib.com ). This is a commerical mobile game engine. Mostly used as 2D Engine. and that you also can do with irrlicht, because it has 2d alpha software blitters.
look at for e.q http://www.umobilegame.com. you see there is no real 3d inside.
Hybrid is opengl-es ready?. did you solve the ARGB<->RGBA problematic? we should dicuss it, if we want to turn the whole engine to use this backbuffer-format. from my point of view ( and for the cpu with software rendering) it's better to have the alpha in the first byte. it saves' one shift per pixel!!;-)
The problem is not only the fpu. burningvideo and irrlicht software renderer are already using a mix between fpu and fixpoint.
The other problem is memory. you need very low poly models and low texture formats.
Fixpoint is just a subset of float. It can only be used save and with optimation ( that means, no special cases handling ) for a whole project if the designer knows exact what he wants. Irrlicht is a general purpose engine and a good starting point for building fast mobile games.
i doesn't matter if opengl-es would exists, without a fpu it's rather useless.
So, iPhone is a much better candiate.
Have a look at EdgeLib ( www.edgelib.com ). This is a commerical mobile game engine. Mostly used as 2D Engine. and that you also can do with irrlicht, because it has 2d alpha software blitters.
look at for e.q http://www.umobilegame.com. you see there is no real 3d inside.
Hybrid is opengl-es ready?. did you solve the ARGB<->RGBA problematic? we should dicuss it, if we want to turn the whole engine to use this backbuffer-format. from my point of view ( and for the cpu with software rendering) it's better to have the alpha in the first byte. it saves' one shift per pixel!!;-)
The problem is not only the fpu. burningvideo and irrlicht software renderer are already using a mix between fpu and fixpoint.
The other problem is memory. you need very low poly models and low texture formats.
Fixpoint is just a subset of float. It can only be used save and with optimation ( that means, no special cases handling ) for a whole project if the designer knows exact what he wants. Irrlicht is a general purpose engine and a good starting point for building fast mobile games.
burningreggae
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Yes, the OpenGL-ES branch is functional - for those systems supporting BGRA modes This fortunately includes the iPhone, so since grafikrobot provided the iPhone device it should work at least on that platform. The Imagination emulator also works.
However, the real solution of flexible color and texture formats is not yet found.
However, the real solution of flexible color and texture formats is not yet found.
Frankly, I doubt it's only a memory issue, since it crashes even with the "Movement" example, reduced to only the revolving cube and sphere. Unless the textures for those are too large - I'll do some tests. Does it make sense that the textures don't display (black objects), and that the engine crashes as soon as the camera clips with something?burningwater wrote:Greetings!
Windows Mobile as gabba already did compiles on pocketpc 2003 with evc4.
It's really just modifying the target platform.
For the crashes, i guess theses are memory issues.
For the Filesystem, yep, smth has to be done. ( the new absolutePath problem arises in b3d loader ).
That's on the emulator of course, I don't know if the graphics behave exactly the same way on the real device.
When you say "you have to downgrade", do you have any specific advice? Would it be a matter of removing code from Irrlicht, or setting some flags on the nodes I create to disable some features? Or would using only very basic models and textures work, without engine-side changes?
I'd really appreciate if you could send me that code, so I can try to run it on my end and see what happens. It may help me realize if I'm doing something wrong. Can you upload it to Mediafire?i extended the windows mobile example to use the helloworld, custom scene node and the terrain example in one executable. all are running on my machine.
Some googling showed interesting instances of fast 3d on a Pocket PC:It can be usefull to build a 3d game with irrlicht on a windows mobile. but you have to downgrade and choose carefully what you will support.
Biggest problem is fpu. a machine without fpu can't really use irrlicht.
software rendering also needs the fpu.
Irrlicht is not really build for low memory situations.
My target machine is an old HTC, which doesn't support anything and is really slow. more than 5-12 fps i never get with a real example. even with the fastest software rendering settings. nikos software renderer is faster here. but it doesn't clip;-)
Bye tom
- Well first, I haven't investigated what you can do with it exactly, but there seems to be some form of Direct3D on WinMobile5+. Could it be used as a backend?
Link: msdn.microsoft.com/en-us/library/ms181014(VS.80).aspx
(apparently, phpBB dislikes parentheses in links... or just dislikes the microsoft site =) )
- There are working versions of Quake, Quake II and Wolf3D for the PocketPC. (Also for Handheld PC.)
The Quake ports are GPL, so we can't really integrate their code into Irrlicht, but at least they can serve as inspiration on how to do things.
- And here's a 3D engine for the PocketPC, not free, unfortunately.
I guess if we're to support the same graphics chips as the iPhone on Windows Mobile devices we'd need a D3D Mobile driver to compliment the OpenGL ES one.
-
- Posts: 24
- Joined: Sun Sep 23, 2007 9:45 pm
- Location: Spain
Hi all,
I had test the sample 17 and i have no good news.
I have loaded the dwarf model with the Irrlicht 1.5 sample and I get 2-3 fps
I have loaded the same model into the rendermania porting and I get 8-9 fps...
The problem with this port is that don´t support jpg files and the button events need to be managed manual. But it have a good performance
I´ve tried it into a Omnia 624MHz.
I had test the sample 17 and i have no good news.
I have loaded the dwarf model with the Irrlicht 1.5 sample and I get 2-3 fps
I have loaded the same model into the rendermania porting and I get 8-9 fps...
The problem with this port is that don´t support jpg files and the button events need to be managed manual. But it have a good performance
I´ve tried it into a Omnia 624MHz.
-
- Posts: 66
- Joined: Wed Oct 04, 2006 2:07 pm
@Dragonazul
1). for me and irrlicht this is good news, if it runs!;-)
2.) what is rendermania?. google doesn't know anything about it and me too;-)
3.) if you want 8-9 fps on windows mobile with my software renderer it is possible. but not with the full irrlicht build.
D3DMobile. It simply doesn't exist on a real device. on a HTC for example you even dont have GAPI or smth else. Windows Mobile is is for outlook. it COULD drive a 3D-Accelerator, but its microsoft. iphone is the better choise;-). Hihi, and i build the windows mobile port;-)
1). for me and irrlicht this is good news, if it runs!;-)
2.) what is rendermania?. google doesn't know anything about it and me too;-)
3.) if you want 8-9 fps on windows mobile with my software renderer it is possible. but not with the full irrlicht build.
D3DMobile. It simply doesn't exist on a real device. on a HTC for example you even dont have GAPI or smth else. Windows Mobile is is for outlook. it COULD drive a 3D-Accelerator, but its microsoft. iphone is the better choise;-). Hihi, and i build the windows mobile port;-)
burningreggae
-
- Posts: 24
- Joined: Sun Sep 23, 2007 9:45 pm
- Location: Spain
Hi Burningwater.
First of all, congratulation for the porting to windows mobile!!! It works great.
Rendermania (google know him if you search "rendermania irrlicht" or with "mirrlicht") refers to the link I put in a previous post:
http://graphicsmakesfun.blogspot.com/20 ... lator.html
8-9 fps are posible with your software renderer ¿how? I would like to test is because I have a bigest aplication in development that would like this.
I have not test your porting complete but I have the rendermania porting working loading several objects, with 3 buttons for events, a static text and a Image with a logo into the screen. And it have good performance
Bad: I only can load .bmp textures, addBillboardTextSceneNode don´t work, it´s based into the 1.2 version of Irrlicht...
If you want to test some specific feature of your porting tell me and i will find some time.
First of all, congratulation for the porting to windows mobile!!! It works great.
Rendermania (google know him if you search "rendermania irrlicht" or with "mirrlicht") refers to the link I put in a previous post:
http://graphicsmakesfun.blogspot.com/20 ... lator.html
8-9 fps are posible with your software renderer ¿how? I would like to test is because I have a bigest aplication in development that would like this.
I have not test your porting complete but I have the rendermania porting working loading several objects, with 3 buttons for events, a static text and a Image with a logo into the screen. And it have good performance
Bad: I only can load .bmp textures, addBillboardTextSceneNode don´t work, it´s based into the 1.2 version of Irrlicht...
If you want to test some specific feature of your porting tell me and i will find some time.