Skip to content

Android backend improvements and fixup (WIP)#2727

Draft
riccardobl wants to merge 2 commits intojMonkeyEngine:masterfrom
riccardobl:androidfixup
Draft

Android backend improvements and fixup (WIP)#2727
riccardobl wants to merge 2 commits intojMonkeyEngine:masterfrom
riccardobl:androidfixup

Conversation

@riccardobl
Copy link
Copy Markdown
Member

This brings the android backend up to par with the desktop ~GL3 backend.
After this PR the android renderer will use GLES3+ only, and support android 11+.

WIP

riccardobl and others added 2 commits April 29, 2026 23:16
Co-authored-by: Copilot <copilot@github.com>
@riccardobl riccardobl changed the title Android backend improvement and fixup Android backend improvements and fixup (WIP) Apr 29, 2026
@github-actions
Copy link
Copy Markdown

🖼️ Screenshot tests have failed.

The purpose of these tests is to ensure that changes introduced in this PR don't break visual features. They are visual unit tests.

📄 Where to find the report:

⚠️ If you didn't expect to change anything visual:
Fix your changes so the screenshot tests pass.

If you did mean to change things:
Review the replacement images in jme3-screenshot-tests/build/changed-images to make sure they really are improvements and then replace and commit the replacement images at jme3-screenshot-tests/src/test/resources.

If you are creating entirely new tests:
Find the new images in jme3-screenshot-tests/build/changed-images and commit the new images at jme3-screenshot-tests/src/test/resources.

Note; it is very important that the committed reference images are created on the build pipeline, locally created images are not reliable. Similarly tests will fail locally but you can look at the report to check they are "visually similar".

See https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-screenshot-tests/README.md for more information

Contact @richardTingle (aka richtea) for guidance if required

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Android implementation to support OpenGL ES 3.0, migrates to AndroidX, and improves the Android harness fragment. It also refactors texture format handling and mipmap generation to be more robust across different hardware. I have identified two issues: the error dialog in AndroidHarnessFragment lacks a dismiss action, and the EGL extension check in OGLESContext is susceptible to false positives.

Comment on lines +205 to 214
requireActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(finalTitle);
builder.setPositiveButton("Kill", AndroidHarnessFragment.this);
builder.setMessage(finalMsg);

AlertDialog dialog = builder.create();
AlertDialog dialog = new AlertDialog.Builder(requireActivity())
.setTitle(finalTitle)
.setMessage(finalMessage)
.create();
dialog.show();
}
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The error dialog created in handleError does not provide any action for the user to dismiss it or close the application. This is a regression from the previous implementation which had a Kill button. Without a way to close the app, the user is forced to kill the process through the OS, which is a poor user experience.

        requireActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                AlertDialog dialog = new AlertDialog.Builder(requireActivity())
                        .setTitle(finalTitle)
                        .setMessage(finalMessage)
                        .setPositiveButton(android.R.string.ok, (d, w) -> {
                            if (app != null) {
                                app.stop(true);
                            }
                            requireActivity().finish();
                        })
                        .create();
                dialog.show();
            }
        });

Comment on lines +251 to +254
private static boolean hasExtension(EGL10 egl, EGLDisplay display, String extension) {
String extensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS);
return extensions != null && extensions.contains(extension);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The hasExtension method uses String.contains() to check for the presence of an EGL extension. This can lead to false positives if an extension name is a substring of another (e.g., checking for EGL_IMG_context_priority could incorrectly match EGL_IMG_context_priority_foo). A more robust check is needed to ensure only exact matches are considered.

    private static boolean hasExtension(EGL10 egl, EGLDisplay display, String extension) {
        String extensions = egl.eglQueryString(display, EGL10.EGL_EXTENSIONS);
        if (extensions == null) {
            return false;
        }
        // Check for a full word match.
        return (" " + extensions + " ").contains(" " + extension + " ");
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant