Questions for Rado1

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
cynex
Posts: 4
Joined: Thu Mar 03, 2016 5:56 pm

Questions for Rado1

Post by cynex »

Hey Rado1

I've been talking with Ville for a while now, and I've started to try out compiling android APK files from zGame as I would really like to make use of zGame as I've become comfortable with the workflow. I've been learning how to use Android Studio as well and can do some basic game loops and image movement, but nothing too complex by any stretch.

I've had some success following the video included in the help file, the Render Particles example. It works just fine across the board quite well as far as I recall. I was able to test it on the device, as well it worked fine in any ARM based Virtual Device inside Android Studio. It wouldn't work however on any x86 x64 emulators. I kept getting the error message : "INSTALL_FAILED_NO_MATCHING_ABIS" which after looking this up, the information I got was that it was missing an image for x64 x86 based emu. I tried to open the project up within Android studio, but it appeared to only load up partial data, all of the assets and resource folders seem to be excluded from the project. I've attached a screenshot of what I mean within the root of the included zip file.

My second test was to try to create a basic shader, nothing at all fancy, simply contained a material->shader and a useMaterial and renderSprite onRender. This didn't work initally (see ShaderTest) as it was set to compatibility mode. this would return the same result on the Phone itself, which was a white box in the middle of the screen.

So I changed the GLBase to ES2/GL3 and this DID work when testing it inside the virtual device (as shown in the screenshot) however, when I run it on the device, I just get a black screen. (see ShaderTest2)

Now I am guessing this is likely because the syntax is different and there's some simple logistical considerations I need to make ?

Any help you could provide here would be very helpful. Ive also included some "droid info" screenshots in case it would help.

Ville had also mentioned you might have some modules to use for android ? I've been looking to use the camera on the device as a TextureSource in a shader. I would like to take the video and overlay some effects using shaders for use with possible VR applications.

Cheers, and thanks in advance !
Attachments
AndroidTests.zip
(2.95 MiB) Downloaded 341 times
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Questions for Rado1

Post by Kjell »

Hi cynex,
cynex wrote:So I changed the GLBase to ES2/GL3 and this DID work when testing it inside the virtual device (as shown in the screenshot) however, when I run it on the device, I just get a black screen. Now I am guessing this is likely because the syntax is different and there's some simple logistical considerations I need to make ?
Correct, when you're using OpenGL ES 2.0, you can't use any of the build-in attributes or uniforms that are available in ( regular / non-ES ) OpenGL 2.0 to 3.2. So, since you're using "gl_Vertex" and "gl_MultiTexCoord0" in your vertex shader, the shader will fail to compile. Fortunately ZGE provides some of these most-used uniforms / attributes automatically when you're using ES2/GL3 mode ( check the Shader component in the Help ).

Also, when you're using varying floating-point based variables, you should define their precision ( or set a default precision ). As quoted from the ES Shading Language manual ..
The fragment language has no default precision qualifier for floating point types. Hence for float, floating point vector and matrix variable declarations, either the declaration must include a precision qualifier or the default float precision must have been previously declared
K
cynex
Posts: 4
Joined: Thu Mar 03, 2016 5:56 pm

Re: Questions for Rado1

Post by cynex »

Many thanks Kjell !
I will follow up if I have any questions after reviewing. I've tried to compile some of the samples, but I keep getting build.xml errors which fail to proceed. Oddly enough when I create an empty project I can build no problem though (and only on 4.1 builds -- for some reason the 2.2 versions say I am missing android-8, even though I believe it to be selected from Android Studio as an option). Checked the ENV variables just in case they get saved in the project as well but no dice as of yet.

Also, is it possible to use the build created from zGame in tandem with Android Studio as a Gradle project ? It would be neat to have android layouts which had uniform controls to pass through similar to how the projects work in FL.

I'm still very green on Android Studio, but nothing seems too foreign yet, got my hello world and very basic game loop running. would be neat to find a balance between zGame projects and Android Studio if possible.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: Questions for Rado1

Post by Rado1 »

Hi cynex,

I'm glad you are trying to use ZGE to build Android applications. Some answers:

* ZGE can compile only for ARM architecture at the moment. Also all external libraries for Android I compiled only for ARM.

* You do not need (and probably should not) to compile your project with Android Studio. The Android project directory structure in ZGE uses conventions from older Android Studios, which is not fully compatible with the current version. You can change it manually (also to be compiled by gradle), but why? I recommend to compile your ZGE Android projects with ZGE calling Android SDK directly. Just set path to Android SDK and ANT in the Settings dialog and compile by "Project / Android: *" menu items.

* Regarding to getting images from camera on Android device, I did some experiments with OpenCV library (see this topic) but did not publish Android version, because the OpenCV library had some memory leaks, so I was not satisfied with it. In meantime, OpenCV started to distribute also Android version, so it can be integrated even easily now. If you want I can have a closer look at it and try to make Android camera working in ZGE; either with OpenCV or without.

BTW I tried to explain building ZGE applications for Android in new help file - section How to / Generate Application for Android. I hope it can help you as well.

Rado1.
cynex
Posts: 4
Joined: Thu Mar 03, 2016 5:56 pm

Re: Questions for Rado1

Post by cynex »

he Android project directory structure in ZGE uses conventions from older Android Studios, which is not fully compatible with the current version. You can change it manually (also to be compiled by gradle), but why?
Couple reasons really : to be able to add support for x86 or x64 if possible for emu testing purposes, as well, to be able to device test quickly as you can connect your device for development, otherwise you need to re-upload the APK, reinstall it using a file manager, then run, rinse and repeat. Android studio has simplified this to just run from within studio. Just more a pain when you have to do this 50 or so times in a session to unit test.
BTW I tried to explain building ZGE applications for Android in new help file
I have followed through the particle example yes, and have been able to get it to work. It's just the shader parts that are giving me grief at the moment.
I tried some of the sample projects but I haven't been able to get 2.2 build working in the Android SDK, only 4.1 at current, and when I change up the demo projects to 4.1 it returns a build error on my box.

Will keep this posted when I find that breakthrough.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: Questions for Rado1

Post by Rado1 »

cynex wrote:to be able to add support for x86 or x64 if possible for emu testing purposes
Unfortunately, Android Studio cannot help you with this. ZGE uses native library libzgeandroid.so which is, at the moment, compiled only for ARM. Java part of the project is just a wrapper for this native library. However, Android Studio can be used in cases when you want to integrate your application with some Android OS features or libraries; I used it, for instance, to provide integration of ZGE with OUYA API.

BTW once Ville provides ZGE engine (libzgeandroid.so) compiled for other platforms, ZGE should run also on them.
cynex wrote:but I haven't been able to get 2.2 build working in the Android SDK, only 4.1 at current, and when I change up the demo projects to 4.1 it returns a build error on my box.
You probably do not have installed Android SDK 2.2. Please look at the help provided in ZGE - menu Help / Contents (or press F1) -> How to / Generate Application for Android / Generating APK.

However, with latest Android SDK you are not able to download it by Android SDK manager, because it is "Not compatible with windows". It is possible to do it manually from here and unpack to the "platforms" folder of your Android SDK installdir. BTW I just discussed with Ville that Android SDK 4.1 will be the default option for generating Android applications in ZGE. Very few devices use 2.2. I updated also help file with additional instructions, it will come in next ZGE beta release.
Post Reply