Android demo problems

edited May 2012 in Help request
Hello everybody,

I have been silent, but still working on my game using Orx. I have some playable demo and I started to fiddle with testing it on Android, and hit a wall.

I downloaded from svn, and followed the wiki tutorial. Unfortunately, I ran into a couple of errors.

First, not all resources are added to the apk by default which results in a missing class (the superclass of the main class, no less). So I edited the project properties: Java Build Path > Order and Export, and selected NvEvent.jar. Perhaps this should be updated directly in svn so future newcomers don't face this problem? Or was I doing something wrong and only solved this by luck?

Second, this one I have not been able to figure out. I encounter this error while running oxrTest:
(orxDisplay_Android_CompileShader() - include/../plugins/Display/android/orxDisplay.c:678) [Assertion failed] : <eError == GL_NO_ERROR && "OpenGL error code: 0x501">

I saw in another thread that this error happened, but I do not have large textures... I am just trying to run the demo!

Thanks in advance.

Edit: Oh, I forgot to mention, this happens even if I remove the shader effect from the Ball object.

Comments

  • edited May 2012
    Ok, I have narrowed it down to the following line in orxDisplay.c:
    orxDisplay_StopShader(orxNULL);
    

    inside of orxDisplay_Android_Init(). I, however, have no enough knowledge of Orx to debug effectively.

    Help is much appreciated!

    Thanks
  • edited May 2012
    Hi duenez,

    looks like shaders don't work on your phone. Does it support OpenGL ES 2.0?

    I haven't touched the Android version myself so faistoiplaisir and lydesik will be able to give you more info or correct me, but I don't think they support OpenGL ES 1.1 for the Android version (which would be used by old hardware/OS I guess?).
  • edited May 2012
    I am trying to run on the AVD emulator and on the device, so I guess neither support shaders. I want to make a game that is of comparable complexity to Angry Birds which runs on that device just fine. I wonder if it would be possible to make shader support optional.

    In any case, it would really help if at least this was not needed to run in the emulator, otherwise debugging would be a nightmare if one can only run directly on the device.

    Thanks.
  • edited May 2012
    duenez, last time I built for Android (several months ago), I couldn't get the emulator to use OpenGL at all. I had to debug Orx on the device only.

    I see the emulator recently (last month) introduced support for OpenGL ES 2.0, so maybe things will work if you have your build environment up to date.
  • edited May 2012
    Again, as I haven't worked on nor with the Android version myself, I don't have all the answers.

    I didn't know that the emulator was now supporting OGL ES 2.0, that's a good news!

    As for debugging on the device, I guess it's only for debugging Android-specific features as you can still run the game natively on win/linux/osx, so it shouldn't have been that much of a drawback and should hopefully happen pretty late in the development process. :)

    Shader support in orx isn't global, it's defined in every display plugins and those are different for computers, iOS and Android.

    On computers, there's no OpenGL ES 1.1 vs 2.0 issue and shaders will only be supported if your hardware support them.

    On iOS/Android, there are two versions of OpenGL ES available:

    - OpenGL ES 1.1: this version has a fixed pipeline and does not support shaders
    - OpenGL ES 2.0: this version doesn't have a fixed pipeline and requires shaders

    The current iOS plugin supports both OpenGL ES 1.1 and OpenGL ES 2.0, it'll try to initialize OGL ES 2.0 first and will fallback on 1.1 were it to fail (and ignore shaders).

    The current Android plugins only supports OpenGL ES 2.0 as far as I know. However I can't give you the exact reasons, only faistoiplaisir and lydesik would be able to answer that question as they are the authors/maintainers of the current Android plugins.
  • edited May 2012
    So, I confirm, actually only OpenGL ES 2 is supported by the Android port.

    Why ? Because developpers were lazy to do it ^^

    Another point is that shaders aren't supported by opengl es 1.1.

    As far as I know, only very old Android device doesn't support Opengl es 2, so this reason contribute to don't support opengl 1.1.

    And, because opengl es 1.1 and opengl 2 are not in the same library, there's some additionnal stuff to do.

    If someone want to do that, why not ;)
  • edited May 2012
    Thank a lot for all the replies.

    The problem is that I don't know if I have an OpenGL ES 2.0 compatible device. And I cannot see the log in the device, so I don't know where it crashes. I have even removed the offending shader calls from orx and recompiled, and it now gets further before it fails. (It actually makes it to the render part of the MainLoop in orxAndroidSupport.cpp)

    I see that the android emulator doesn't support OpenGL ES 2.0 as of now, although they do support GPU emulation and acceleration. I guess if all else fails, I might just go ahead and add compatibility to OpenGL ES 1.1 to orx, but I would probably need a ton of help in getting to know what to do.

    For starters, what would be needed to make this happen? What is missing? Can anyone give me a simple roadmap? Would it be very difficult? I have some (as in, I have built a couple of applications for data visualization, so, not much :( ) experience coding in OpenGL, but I have never used ES.

    Thanks a bunch again!
  • edited May 2012
    I haven't looked into the details, but it looks like the newest update to the emulator should support this. Have you seen it?

    http://android-developers.blogspot.ca/2012/04/faster-emulator-with-better-hardware.html
  • edited May 2012
    Yeah, they support it in the beta, but it is not officially supported yet... I'll check it out, thanks!
  • edited May 2012
    There are probably barriers that I'm not aware of on the way to support OpenGL ES 1.1 in the Android version, but I think the main issue comes from the fact that you can't link an application with the 2 OGL ES versions at the same time.
    You either have to pic one at compile time or have to dynamically load the library you need.

    But if you manage to pass that hurdle, actually supporting a fixed pipeline shouldn't be too bad and you can use the iOS plugin as an inspiration (which is already an inspiration to the Android OGL ES 2.0 version if I'm not wrong).
  • edited May 2012
    to "test" if your device support OpenGL ES 2.0

    search for "opengl extension" in the Android Market from your device (not the website)

    If you can see the app in the result, your device supports OpenGL ES 2.0, you can install and test, if you don't see the app, it means the market hides it for you because your device doesn't support it.

    As irawain said, it should not be difficult to write an OpenGL ES 1 Display driver for orx.

    The easyest way would be to write a completly new driver and new make rules to link against opengles 1 lib instead of opengles 2 lib,

    a better but more complex way would be to dynamicaly link to the right lib, and retrieve the functions pointers...

    Honestly, I won't do this myself as opengl ES 1 devices represent a few percentage, and I think mainly used by non-gamers users. (sorry for you if you are in that case)

    lydesik
  • edited May 2012
    Thank you lydesik. I have downloaded the app, and it shows that the device is, indeed, compatible with OpenGL ES 2.0, however, the shading language is GLSL ES 1.0, which I assume is the problem. I am guessing this might be actually easier to deal with in orx, because I would only have to bring compat of shaders back to 1.0. Am I right?
  • edited May 2012
    Just to clarify things:
    - OpenGL ES 1.X doesn't have any shader support at all
    - OpenGL ES 2.0 has support for OpenGL ES Shading Language 1.0 (there's no newer version yet).

    So I'm not sure what's going wrong with your phone. :(
  • edited May 2012
    Hmmmm, is there a way to get the Log file from the android device? Perhaps I could trace this and see what is happening.
  • edited May 2012
    there is a log file in
    /data/data/<packagename>/files/

    you can retrieve it with adb pull

    but it's not really usefull as everything is already sent to logcat

    on which device are you running exaclty? manufacturer / model ?

    it might be that the share compiler / linker doesn't like something (like variable name etc...)

    lydesik
Sign In or Register to comment.