Bowling Alley 3D for [Android]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
shruglins
Posts: 6
Joined: Tue Mar 27, 2012 9:52 am

Bowling Alley 3D for [Android]

Post by shruglins »

Hi,

I have been working this last month on Bowling Alley 3D for Android, all the graphic pipeline is done in Irrlicht using the OGLES driver for Android.

I will add many new features in the next month if I have enough hours to spend on this game, so any suggestions will be welcommed, I hope you enjoy the game.

Here is the link to the game:

play.google.com/store/apps/details?id=com.igugames.bowlingAlley3D

Thanks to all the team of Irrlicht, it's a great engine!
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Bowling Alley 3D for [Android]

Post by Virion »

Nice. It seems like Irrlicht is working pretty well on mobile platform. Did you face any problem using the OGLES driver?
shruglins
Posts: 6
Joined: Tue Mar 27, 2012 9:52 am

Re: Bowling Alley 3D for [Android]

Post by shruglins »

I had some issues, first of, I'm still not resuming the OpenGL context, as you may know, when you pause an app in Android the openGL context is lost (texture, vertex buffers...) and you have to reload everything when the app resumes. Currently I'm shuting down the app everytime it goes on pause, so everytime you return to the app it is not resuming, it's starting again from scratch.

I'm currently working on this problem, to be able to introduce new features like leaderboards (with openFeint) (which are pausing/resuming the app when you enter on the leaderboards view).

And another problem I found was that all the textures on Adreno GPU's (that' the Sony Xperia phones for instance) where white, so I had to change the color format of the textures (this one was difficult to solve because I have a phone with a PowerVR gpu so I didn't see this mistake until I tested the game with an Xperia phone which a friend lend me).

Oh yeah, I almost forgot, I wanted to add lightmaps to the meshes, but somehow I couldn't, I am exporting the meshes to Ogre format as I know they support more than one texture coordinates, but when I tried to add the lightmap the mesh was being textured only with the lightmap coordinates.

I think I will search on the forums to see if there's any info in restoring the openGL context.

Cheers.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Bowling Alley 3D for [Android]

Post by hybrid »

No, context preservation is pretty hard and also not supported in all Android versions. For Irrlicht there's basically no way to achieve this. Lightmaps for Ogre format should be supported since a few weeks or so, but should be also available in latest ogl-es repository.
Can you support app2sd, please, because my free internal flash has only a few MB
shruglins
Posts: 6
Joined: Tue Mar 27, 2012 9:52 am

Re: Bowling Alley 3D for [Android]

Post by shruglins »

Yesterday I updated the app to support app2sd, I think you would only have to update the app and you will be able to transfer the app to your sd card.

As I understand you are saying that there is no way to preserve the context? But what I want to do is not preserving the context, I want to restore it reloading the textures and vertex buffers. I guess I can do this, no?

Sorry for my english, I'm from spain.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Bowling Alley 3D for [Android]

Post by Virion »

Not sure if these links could help. Not irrlicht specific but might give you an idea.
http://stackoverflow.com/questions/2112 ... gl-context
http://stackoverflow.com/questions/5965 ... r-a-resume
http://groups.google.com/group/android- ... 206bc75c40
I think probably need some native functions from android SDK? Not sure just try to help.
shruglins
Posts: 6
Joined: Tue Mar 27, 2012 9:52 am

Re: Bowling Alley 3D for [Android]

Post by shruglins »

Thanks for pointing to this links with info Virion,

That's exactly my problem right now, but when I am trying to reload the textures when resuming the app (for instance, the textures that i'm using as buttons which don't even have any vertex buffer since it's created on the fly when i call draw2DImage, so only reloading the textures I would be able to see them again) I cannot see anything... not even the button with a white texture.

Maybe hybrid may know if I am missing something, maybe I need to restore some OGLES parameters that are being set when the ogles driver is created.
shruglins
Posts: 6
Joined: Tue Mar 27, 2012 9:52 am

Re: Bowling Alley 3D for [Android]

Post by shruglins »

Hello again,

Yesterday I talked with "tonic", another member of the forum and one the team members of Stair Dismount, I asked him if he could tell me any hints about restoring the openGL context since they are using Irrlicht on the graphic pipeline. He responded really quickly and gave me the key for restoring the context correctly, now my game can be paused/resumed and everything works fine, so below is what he told me in order to restore the openGL context, I hope somebody will find this useful:

we have a slightly modified irrlicht, which handles this in quite straightforward way:

- For the COGLESTexture (ITexture), there is a recreate() method which generates a new texture id and calls the texture uploading method again (I think a copy of the image is already kept in memory by COGLESTexture objects!)
- For the COGLESDriver (IVideoDriver), there is a new reset() method which calls texture recreate() for all textures, and then just sets all the GL state again (hints, depth/alphafunc states, lights, 2D 3D render states on/off, fog, currently used material textures or so..)

- When the Android onSurfaceChanged/Created gets called, then the driver reset is called

Thanks tonic!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Bowling Alley 3D for [Android]

Post by hybrid »

So which parts are you actually keeping, and which do you recreate? I'm just wondering if a complete recreation of the device is more work or not. But anyway, yes, the reset function I wrote for the ogl-es part was at least thought for these things. But since I didn't really started on the Android programming , yet, I never implemented anything into those functions. For D3D we already have certain reset and recreation steps, but OpenGL never needed it so far.
So why do you need a new texture id? Can't we re-use the existing ones?
shruglins
Posts: 6
Joined: Tue Mar 27, 2012 9:52 am

Re: Bowling Alley 3D for [Android]

Post by shruglins »

Maybe this could be best answered by tonic which is the man who told me how to do it. I had the same thoughts like you but as he told me in a very specific way how to do it I just tried it and it worked, plus, I don't have too much time to test or try things as my time is very limited, and if this was not enough when I change things on the Irrlicht code to generate a new irrlicht library I have to compile the code in an old linux machine I have because in windows it refuses to compile with cygwin (the "argument list too long" error...).

Anyway (I'm not here to explain my coding headaches hehe), as you point, a complete recreation of the device would be more work, as you should have to reload at least all the vertex buffers. This is what bothers me of Android, they tell you that you have to restore the context but they don't tell you what parts are still keeped... I guess the idea is to recreate the device from scratch to avoid any problems.

About the texture Id, I guess that if tonic specifically said that you need a new one it is because the old one is erased...

I guess that by "keeping" you could say that I keep the vertex buffers since I don't touch anything of that when pausing/resuming the app. To restore the textures you just need to create a new texture id and call the uploadTexture method, for the coglesdriver you just have to set the gl states, I do this by calling a very similar method to genericDriverInit.

I hope this expands the answer tonic gave me.

Don't hesitate to ask more specific questions if you want to.
Post Reply