I’ve been working on adding support for OpenGL ES 3.0, GLSL 300 and newer to jme3. Nowadays it includes the following:
Initialize the proper opengl context (2.0, 3.0, 3.1…)
Added Caps for all of the new supported features
Added Instancing as core feature of GLES30 and newer
Properly adding versioning to shaders (#version xxx es) to shaders
Added GLSL320,GLSL310 and/or GLSL300 to most materials depending on the required level for them to work properly
Added depth24 texture usage if hardware supports it
Enabled Geometry shaders and tessellation (3.2 core feature and 3.1 as extension) and fixed compilation errors on the examples
Enabled glBlitFramebuffer
Added GLSL300 to filters not able to work with GLSL100.
Created Glsl300ShaderGenerator to support GLSL300 in shadernodes
Fixed most shader compilation issues (strict type checking, adding OpenGL ES specific extensions, function usage depending on version and some other)
Set default precision to highp solving most filter issues although maybe a little slower. Added specific sampler precision definition for gles300 or newer
Make use of GL_TEXTURE_MAX_LEVEL in GLES300 to avoid black rendering of non complete mipmapped textures
Changed some assets from compressed formats not supported in android to RGB/RGBA depending on the needs so all effects and tests can run also on android
updated precompiled android.jar to have access to newest android API
enabled some other core features of GLES300, GLES310 and GLES320
Fixed build issues in jme3-android-examples
Added 3D texture and texture array support
Added float texture formats, fixed rgb8 format if having cap rgb8 and fixed glTexImage2D call on AndroidGL
PBRLighting works and any other effect requiring HDR texture formats should work also
Effects and postprocessing
Multisampling
Half-done:
Fixed most issues with shadow rendering in android (GLES 2.0 and GLES 3.0 or better) although some glitches still apear depending on ShadowMode of the nodes
Fixed water filter. Still some rendering glitches in my old redmi3 (gles3.0). The water renders properly but the rest of the scene is overwritten in red
Pending:
Finish the previous half-done work…
If you feel there’s something interesting I’m missing please comment and I’ll add it to the list although may not be in the first PR
Thank you greatly @joliver82 for your hard work and contribution to the android side of jME.
I am a huge Android fan and have a few apps out on the play store.
I however have one question to you, what is your development cycle for android apps?
In other words how do you develop? Do you use jMonkeyPlatform, gradle or android studio?
Sadly my development cycle for jme3 based android apps is unconfortable as hell.
As I started with really old versions of jme3 (alpha2) and my project was not defined only for android, I’m using jmonkey sdk + a slightly modified android studio project from GitHub - noncom/jme-android-example
I have NBandroid installed and enabled android build so the mobile path is created. I used that as base for the project I linked (adding symbolic links for libraries, code, assets and so).
The cycle is like:
Work on the game itself in jmonkey
Make a full build, so although android compilation fails it generates all libs, assets and so in the destination folder used by the android studio project
Add android specific functionality in android studio and generate the apk
Probably there are plenty of better options, like just using the linked project or any other similar as starting point for your development but if using android studio or any other IDE you’ll loose the functionality jmonkey SDK has…
If anyone knows a better approach I’ll be happy to hear from you
Not still. I’m adding stuff day by day and now I’m focused on getting shadows working 100% which is taking me more time than expected. It’s a complex topic for me
Not an android developer, but hopefully this might be helpful, I was able to create my ever first android hello world app in JME easily using this Gradle template.
Edit:
After build it generates two apks, one inside debug directory an one in the release directory. The debug one can be easily installed on smartphone, but I guess the release one needs to be signed with Java Keystore which unfortunately I couldn’t figure it how.
Well my approach is a bit different.
I am also using the jMonkeyEngine SDK except the difference is I actually build android using the old sdk ant build as documented in the wiki.
I have to make my own build of the SDK because in order for the NBAndroid plugin to work in the jME sdk you need version 8.1 of netbeans.
I could have used the gradle scripts from the android studio project I used as reference instead of fully install android studio but I think for my use case it’s better to have it, specially if you develop other android apps not jme based and/or to be able to debug android apps more or less easily.
I miss the good old times when eclipse was de default IDE for android…
On the other hand, it’s a good manual I would have loved to have it when I started trying to compile my app for android with multidex (that’s the reason I moved to android-studio and gradle)
It’s a good aproach. I didn’t realize the issue with nbandroid was that newest jmonkey sdk is based on a newer netbeans release. Anyway, I would prefer to have NBandroid updated but it seems that the developer stoped mantaining it
Thanks for your comment @jayfella but it’s the whole build.gradle file. What I’m trying to compile is the jme3-android library, not an application, so all other settings related to android are not accesible :
What went wrong:
A problem occurred evaluating project ‘:jme3-android’.
> Could not find method android() for arguments [build_akah3vddwdy7zw5ofwuoggqvr$_run_closure1@a96f79e] on project ‘:jme3-android’ of type org.gradle.api.Project.
I could try to change it from regular java to android library (apply plugin: ‘com.android.library’) and setting all stuff there but I think there should be other method.
OK, I found out… it’s the library at /jmonkeyengine/lib/android.jar the one having the android classes. Just updating it to a newer version including GLES31 and GLES32 will suffice
I’m working trying to get shadows to android gles3 but I’m facing a weird issue, depending on the device I’m getting the shadows rendered or just overriding the scene in grey:
And I don’t understand why. The depth map is properly generated in all devices tested and I’ve simplified the rendering by creating a new material based on the unshaded.j3md but instead of using the default PostShadow.frag I’m using a simplified version that’s just rendering depth over the scene: