jmonkeyengine icon indicating copy to clipboard operation
jmonkeyengine copied to clipboard

No gamma correction field in Android JmeHarness

Open ghost opened this issue 8 years ago • 5 comments

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

ghost avatar Jan 16 '18 11:01 ghost

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

Nehon avatar Jan 16 '18 13:01 Nehon

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

pavly-gerges avatar Mar 13 '21 20:03 pavly-gerges

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

Markil3 avatar Apr 15 '21 03:04 Markil3

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 avatar Apr 15 '21 20:04 pavly-gerges

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

pavly-gerges avatar Nov 19 '21 15:11 pavly-gerges