Author Topic: Android StandaloneScene class not working  (Read 5269 times)

igor_c

  • Jr. Member
  • **
  • Posts: 5
Android StandaloneScene class not working
« on: August 07, 2014, 06:51:14 AM »
Hello,
I've tried to follow the android tutorial and put StandaloneScene exemple class to work but I only get a grey background. I can't figure out what's going wrong.
The model, texture and font are in assets folder. The model format is obj. I've tried to convert it into a .jmf with the viewer but it didn't work either.

I've already put the following line in the manifest file:

Here is the code:



Sorry for any grammar error, english is not my native lenguage.
Thanks in advance.

jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: Android StandaloneScene class not working
« Reply #1 on: August 07, 2014, 08:12:36 PM »
Can you also add the console/ddms logs do give a look ?

igor_c

  • Jr. Member
  • **
  • Posts: 5
Re: Android StandaloneScene class not working
« Reply #2 on: August 07, 2014, 09:20:44 PM »
Sure! Please, take a look:


jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: Android StandaloneScene class not working
« Reply #3 on: August 07, 2014, 09:46:02 PM »
The third party lzma.jar is missing which prevents the model to load.
Can you re-try with this jar, and paste the logs if the model is still not showing ?

Edit: or alternativly disable lzma compression during jmf conversion (you may also notice slightlty faster loading).
« Last Edit: August 07, 2014, 10:48:10 PM by jerome_j »

igor_c

  • Jr. Member
  • **
  • Posts: 5
Re: Android StandaloneScene class not working
« Reply #4 on: August 08, 2014, 12:25:21 AM »
Done. Still not working.
I've made a simple cube.obj and converted it into jmf with no compression, no textures, as simple as possible.
In my code I've just changed "settings.stream = new Stream("/models/jmf/XWing.jmf");" to "settings.stream = new Stream("/models/jmf/cube.jmf");" and put the file in the correct folder. The model is still not showing.

The log:


jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: Android StandaloneScene class not working
« Reply #5 on: August 08, 2014, 09:01:16 AM »
There's obviously a problem during the shader generation with your model, which explains you're not seeing anything.
I'll give a look to see what's going on.

In the meantime, you may try with a model having material/texture. You can also try to load your model with the model viewer (desktop and android versions) to see if it's an android specific bug or if it's reproductible on other platforms too.

jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: Android StandaloneScene class not working
« Reply #6 on: August 08, 2014, 07:16:21 PM »
If you're using a model from an obj without any material, ie without the associated mtl file, it is as expected to not being rendered on android. With the current 1.3.2 build, it is required to have a material so the engine can generate a shader (which is required for rendering by opengles 2 backend).

I'm not sure yet why you get an exception in the shader generation in your log, but I'll investigate that.

igor_c

  • Jr. Member
  • **
  • Posts: 5
Re: Android StandaloneScene class not working
« Reply #7 on: August 08, 2014, 09:21:52 PM »
Its working with the model viewer on android and desktop. All the models are loaded correctly (jmf and obj).
I also tried to load the Xwing model that came from the tutorial. It have texture and material.

Take a look at my simple cube obj file:



And its mtl:


jerome_j

  • Administrator
  • *****
  • Posts: 116
    • Bonzai Engine
Re: Android StandaloneScene class not working
« Reply #8 on: August 08, 2014, 09:29:40 PM »
The tutorial was not properly updated to the recent changes introduced in 1.3.2 release. The ShaderGenerator now requires a MaterialLibrary:

Also, the (new) easiest way to initialize an AssetManager is:

I'll update the tutorial and add a better exception.
I don't usually check/run the standalone tutorials, you may find better code to look at in the other tutorials.
« Last Edit: August 08, 2014, 09:36:38 PM by jerome_j »

igor_c

  • Jr. Member
  • **
  • Posts: 5
Re: Android StandaloneScene class not working
« Reply #9 on: August 08, 2014, 10:10:17 PM »
Thanks Jérôme !
Everything is working very well now.