Native Android port
Re: Native Android port
mazataza, the reason why it crashes if you leave the AndroidAssetFileArchive there is simply because it wasn't done in the correct location.
see my post here: http://irrlicht.sourceforge.net/forum/v ... 56#p277040
All you have to do is move the crashing code block before createDriver(). That's it.
I made a patch for Nadro, but I think he has forgotten about it
see my post here: http://irrlicht.sourceforge.net/forum/v ... 56#p277040
All you have to do is move the crashing code block before createDriver(). That's it.
I made a patch for Nadro, but I think he has forgotten about it
Re: Native Android port
Looks like I fixed the compile error by simply adding the following function CIrrDeviceAndroid.cpp/h
I don't think we need this function on Android. There are no 'windows'. I ran it and it seems to work in OpenGL ES 1. I haven't tried OpenGL ES 2 because I cannot find my shaders.
Code: Select all
core::position2di CIrrDeviceAndroid::getWindowPosition()
{
return core::position2di(-1, -1);
}
Re: Native Android port
I thought they were adding windows to the tablet interface in recent Android versions? Seems such a waste to have a 12" screen that only displays one app.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Native Android port
We are in a major rework of the ogl-es2 driver. After that, the iPhone and Android devices will be updated. So might take a little longer. Maybe better put the patches to our tracker if you haven't done so. This will ensure they are not lost somehow (http://sourceforge.net/tracker/?group_i ... tid=540678)mchiasson wrote:I made a patch for Nadro, but I think he has forgotten about it
Re: Native Android port
I don't care that much for the patch. If it helps others to get by, then I am happy. If you guys need it to fix the segfault in Android with the Ogles2 driver, then that's solved for you. If you guys want to do a complete rewrite, then that's fine too.
Re: Native Android port
I'm sorry that it took so long. Tomorrow when I'll back from my work I'll apply patches for Android (+patch from Hiker).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: Native Android port
Hi all,
can you point me to android native app(sample), that use irrlicht?
cant find it...
can you point me to android native app(sample), that use irrlicht?
cant find it...
Re: Native Android port
mazataza, thank you for your post. It is tremendously helpful. I was able to piece together enough from your code snippets and other forums to get irrlicht "running" on the emulator but I only have it to the black screen you mentioned. Are you willing to post your code for us?
I'm currently building for OpenGL ES 1.0? After working on this for the last week, I would be so happy to see a box like you got even if it is @ 7 FPS.
Thanks again.
I'm currently building for OpenGL ES 1.0? After working on this for the last week, I would be so happy to see a box like you got even if it is @ 7 FPS.
Thanks again.
Re: Native Android port
Did you try example no. 10 from ogl-es branch? It works under Android. Anyway android.mk is missing, so you have to add this file. Currently I'm working on official example for both iOS and Android, but I need some more time to finish it. Please be patient, it'll be available soon, many users request it, so at now it's my priority in tasks related to Irrlicht.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: Native Android port
Android example is ready to use (tested with Sony Xperia Sola). You can find an short tutorial in commit log.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: Native Android port
Hello,
I think I found a bug in the driver, which causes a crash at app startup (I was wondering why the example HelloWorldMobile was working without problems and my app crashed, and digged into the source code).
AFAIK, createAndOpenFile(...) returns 0 if the file failed to load. In this function, it is assumed the file is loaded successfully...
File: COGLES2Driver.cpp
In function: createMaterialRenderers()
The function is rather large, and such code is repeated throughout it. I think these lines:
should be changed to:
Also, if a file fails to load, maybe the engine can output a debug log string for it. And if Irrlicht cannot work without those shaders, either they should be included in the source or a big red notice should be put in the doc (I prefer the first one )
Apart from that , the driver seems to work well.
PS: I can make a patch if you want, but that will have to wait until the end of the week.
I think I found a bug in the driver, which causes a crash at app startup (I was wondering why the example HelloWorldMobile was working without problems and my app crashed, and digged into the source code).
AFAIK, createAndOpenFile(...) returns 0 if the file failed to load. In this function, it is assumed the file is loaded successfully...
File: COGLES2Driver.cpp
In function: createMaterialRenderers()
Code: Select all
// Those 2 files can fail to load (for example, there is no "asset/media/Shaders/*.*" files)
// In this case, 0 is returned
io::IReadFile* FPVSFile = FileSystem->createAndOpenFile(FPVSPath);
io::IReadFile* FPFSFile = FileSystem->createAndOpenFile(FPFSPath);
c8* FPVSData = 0;
c8* FPFSData = 0;
long Size = FPVSFile->getSize(); /// BOOM, segfault if file failed to load
if (Size)
{
FPVSData = new c8[Size+1];
FPVSFile->read(FPVSData, Size);
FPVSData[Size] = 0;
}
Size = FPFSFile->getSize(); /// BOOM again, if the other file was not loaded
if (Size)
{
// if both handles are the same we must reset the file
if (FPFSFile == FPVSFile)
FPFSFile->seek(0);
FPFSData = new c8[Size+1];
FPFSFile->read(FPFSData, Size);
FPFSData[Size] = 0;
}
if (FPVSFile)
FPVSFile->drop();
if (FPFSFile)
FPFSFile->drop();
Code: Select all
long Size = FPVSFile->getSize(); /// BOOM, segfault if file failed to load
if (Size) // ...
Code: Select all
long Size = (FPVSFile != 0 ? FPVSFile->getSize() : 0);
if (Size) // ...
Apart from that , the driver seems to work well.
PS: I can make a patch if you want, but that will have to wait until the end of the week.
Re: Native Android port
In final release all shaders from media/Shaders will be included in Irrlicht code. Current solution is just temporary for easier shaders developing process. Any patches aren't required in this case, because this code will be removed soon (without shaders OGl ES2.0 doesn't work, so simple 'if(File)' doesn't help too much).
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: Native Android port
Anyway if you will find some Android bugs please report it. This port is in alpha stage, so reports will be useful.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: Native Android port
Hi again,
I have a little problem with textures; I load a b3d model which have a texture; when executing the pc version, everything is loaded fine, but on Android (with OGLES2) the texture is not loaded (while mesh + animations are perfectly loaded). The only difference between the android and the pc version is the main function (for android it's android_main, for pc it is main).
My "assets" directory is looking like:
Irrlicht logs (approx):
After looking in the sources, the b3d loader checks for "<b3d-path>/<texture>", but here the <b3d-path> is made absolute by getMesh(). I think that may be the problem on Android, since the files are in the apk... Do you have ideas / workaround for this ?
I have a little problem with textures; I load a b3d model which have a texture; when executing the pc version, everything is loaded fine, but on Android (with OGLES2) the texture is not loaded (while mesh + animations are perfectly loaded). The only difference between the android and the pc version is the main function (for android it's android_main, for pc it is main).
My "assets" directory is looking like:
Code: Select all
- assets
- data
- player
- player.b3d
- player.bmp
- media
- Shaders
- ...
Code: Select all
Using texture: player.bmp
[...]
Could not open file of texture: player.bmp