jMonkeyEngine / jMonkeyEngine/jmonkeyengine

Remove JOGL and library specific AppSettings and the reflective code to instantiate non LWJGL3 desktop backends.

Open
#2,777 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Refactoring and Cleanup
Dominant language
Java
Stars
4.3k
Forks
1.2k
Avg merge
4d 7h
Merged PRs (30d)
14

Description

Originally jme used to support multiple opengl/al bindings on desktop, but nowadays we pretty much settled with LWJGL3.
We should deprecate all the LWJGL_ JOGL_ keys in AppSettings and add generic OPENGLXX OPENGLESXX to select opengl(es) versions (when possible).

We should also replace all this reflective code in JmeDesktopSystem

  @Override
    public JmeContext newContext(AppSettings settings, Type contextType) {
        initialize(settings);
        JmeContext ctx;
        if (settings.getRenderer() == null
                || settings.getRenderer().equals("NULL")
                || contextType == JmeContext.Type.Headless) {
            ctx = new NullContext();
            ctx.setSettings(settings);
        } else if (settings.getRenderer().startsWith("LWJGL") || settings.getRenderer().startsWith("ANGLE")) {
            ctx = newContextLwjgl(settings, contextType);
            ctx.setSettings(settings);
        } else if (settings.getRenderer().startsWith("JOGL")) {
            ctx = newContextJogl(settings, contextType);
            ctx.setSettings(settings);
        } else if (settings.getRenderer().startsWith("CUSTOM")) {
            ctx = newContextCustom(settings, contextType);
            ctx.setSettings(settings);
        } else {
            throw new UnsupportedOperationException(
                    "Unrecognizable renderer specified: "
                    + settings.getRenderer());
        }
        return ctx;
    }


    @Override
    public AudioRenderer newAudioRenderer(AppSettings settings) {
        initialize(settings);

        AL al;
        ALC alc;
        EFX efx;
        if (settings.getAudioRenderer().startsWith("LWJGL")) {
            al = newObject("com.jme3.audio.lwjgl.LwjglAL");
            alc = newObject("com.jme3.audio.lwjgl.LwjglALC");
            efx = newObject("com.jme3.audio.lwjgl.LwjglEFX");
        } else if (settings.getAudioRenderer().startsWith("JOAL")) {
            al = newObject("com.jme3.audio.joal.JoalAL");
            alc = newObject("com.jme3.audio.joal.JoalALC");
            efx = newObject("com.jme3.audio.joal.JoalEFX");
        } else {
            throw new UnsupportedOperationException(
                    "Unrecognizable audio renderer specified: "
                    + settings.getAudioRenderer());
        }

        if (al == null || alc == null || efx == null) {
            return null;
        }

        return new ALAudioRenderer(al, alc, efx);
    }


with known class paths eg. com.jme3.system.DesktopGL that the backend modules (such as jme3-lwjgl3) can implement.

This should probably be resolved after we get rid of the lwjgl2 backend.

Some non-breaking progress on this was made as part of https://github.com/jMonkeyEngine/jmonkeyengine/pull/2776 to simplify android development

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with AppSettings and JmeDesktopSystem, then review the progress in pull request #2776 and the backend modules such as jme3-lwjgl3. The work is ready when library-specific settings are deprecated, generic OpenGL settings are defined, and reflective desktop and audio backend selection is replaced with known class paths. The issue notes that this should follow removal of the lwjgl2 backend.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, desktop-dev
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.