Skip to content

toggle srgb on per framebuffer basis#2729

Merged
riccardobl merged 4 commits intojMonkeyEngine:masterfrom
riccardobl:srgb
Apr 30, 2026
Merged

toggle srgb on per framebuffer basis#2729
riccardobl merged 4 commits intojMonkeyEngine:masterfrom
riccardobl:srgb

Conversation

@riccardobl
Copy link
Copy Markdown
Member

This makes srgb framebuffer usable in offscreen rendering

@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 introduces logic to manage sRGB write state for framebuffers in the GLRenderer, including a new toggleFramebufferSrgb method and state tracking in RenderContext. The review identified a critical issue where the code references a non-existent Caps.SrgbWriteControl constant, which will lead to compilation errors. Additionally, there is a suggestion to move the RenderContext state update inside the capability check to ensure it accurately reflects the GL state.

Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java Outdated
@riccardobl
Copy link
Copy Markdown
Member Author

@gemini-code-assist pls new review

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 introduces state tracking for sRGB framebuffer writing to ensure consistent behavior across different framebuffers. It adds a srgbWriteEnabled field to RenderContext and a toggleFramebufferSrgb method to GLRenderer to manage the GL_FRAMEBUFFER_SRGB_EXT state during binding and copying operations. The review feedback highlights the need to initialize the new state field in RenderContext to avoid desynchronization after a context reset and suggests an optimization for the toggleFramebufferSrgb method to check for hardware capabilities early.

Comment thread jme3-core/src/main/java/com/jme3/renderer/RenderContext.java
Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
@riccardobl
Copy link
Copy Markdown
Member Author

@gemini-code-assist pls new review

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 introduces tracking and toggling of the sRGB write state by adding a srgbWriteEnabled flag to RenderContext and a toggleFramebufferSrgb method to GLRenderer. The feedback suggests removing redundant assignments in copyFrameBuffer and optimizing toggleFramebufferSrgb with an early return for hardware capability checks and improved Javadoc capitalization.

Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
@riccardobl riccardobl merged commit 5af1548 into jMonkeyEngine:master Apr 30, 2026
19 checks passed
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