jMonkeyEngine / jmonkeyengine

A complete 3-D game development suite written in Java.
http://jmonkeyengine.org
BSD 3-Clause "New" or "Revised" License
3.81k stars 1.12k forks source link

No gamma correction field in Android JmeHarness #809

Open ghost opened 6 years ago

ghost commented 6 years ago

There is no protected field available in com.jme3.app.AndroidHarness to enable/disable gamma correction. This can be fixed by adding a protected field and adding it to the AppSettings initialization code.

https://github.com/jMonkeyEngine/jmonkeyengine/blob/master/jme3-android/src/main/java/com/jme3/app/AndroidHarness.java#L223

Nehon commented 6 years ago

Gamma correction won't work on android unless it's using opengl es 3. The setting is not exposed on purpose. Maybe we should allow it only if opengl version is es 3 but some test have to be done to ensure that it's working exactly the same than on desktop

For information we need those 2 things: this extension https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_framebuffer_sRGB.txt and srgb image formats https://www.khronos.org/opengl/wiki/Image_Format#sRGB_colorspace

pavly-gerges commented 3 years ago

I will investigate this problem & see if i can do something here.....

Markil3 commented 3 years ago

Have you made any leeway on this, @Scrappers-glitch?

pavly-gerges commented 3 years ago

Have you made any leeway on this, @Scrappers-glitch?

i have tried to enable the gamma correction via this snippet :

  ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        ConfigurationInfo info = am.getDeviceConfigurationInfo();
   // above OGLES3.0, enable sRGB
            if (info.reqGlEsVersion >= 0x30000) {
                 renderer.setMainFrameBufferSrgb(settings.getBoolean("GammaCorrection"));
            }

for OGLES3.0 & up from OGLESContext.java class, directly using the AppSettings#getBoolean("GammaCorrection") before initializing the renderer here :

https://github.com/jMonkeyEngine/jmonkeyengine/blob/33a75dddddb8258a35732d8c5a79230e1d3bc0b6/jme3-android/src/main/java/com/jme3/system/android/OGLESContext.java#L214

Generally saying, to enable gamma correction, you have to enable the sRGB frameBuffer from the renderer class using:

https://github.com/jMonkeyEngine/jmonkeyengine/blob/33a75dddddb8258a35732d8c5a79230e1d3bc0b6/jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java#L3224

, but it didn't work, @Markil3 if you have any suggestions, please let me know.

pavly-gerges commented 2 years ago

Check this : https://github.com/jMonkeyEngine/jmonkeyengine/pull/1665