Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure existing OpenGL state is respected. #449

Merged
merged 3 commits into from
Apr 26, 2023

Conversation

reworks-org
Copy link
Contributor

Only done for GL3 backend for now.

Partially resolve #437

Still need to add checks around where EnableScissorRegion is called by RmlUi.

@mikke89
Copy link
Owner

mikke89 commented Apr 24, 2023

Thanks! This is a welcome addition.

I want to clarify one aspect here: I agree with setting and backing up the state during the begin- and end frame calls. However, for performance reason I think it's a good idea to reserve the ability to change the GL state between render calls. The changes made in this PR is perfectly in line with this though, so it doesn't involve any further changes here. However, this means we at some later point might, for example, leave the current program in a non-zero state, and expect it to remain that way for the next render call.

I'm not sure I understand what you mean with the internal changes needed regarding the scissoring. Following the above clarification, we only need to initialize, and restore the state during the BeginFrame/EndFrame calls.

Could you also add the backup/restore for the blending and stencil functions? I'd rather merge this without any TODOs.

@mikke89 mikke89 added the backends Platforms and renderers label Apr 24, 2023
@reworks-org
Copy link
Contributor Author

reworks-org commented Apr 25, 2023

Doh, just realized it doesn't matter what changes are done by rml during rendering, since we have already backed it up and are restoring after anyway...

@reworks-org
Copy link
Contributor Author

reworks-org commented Apr 25, 2023

pushed changes. Should fully resolve #437

@mikke89
Copy link
Owner

mikke89 commented Apr 25, 2023

Hey, I just added some more GL state to the backup, and did some refactoring. Let me know if you find any issues, otherwise I will merge it like this.

@reworks-org
Copy link
Contributor Author

lgtm

@mikke89 mikke89 merged commit bb9f6a4 into mikke89:master Apr 26, 2023
@mikke89
Copy link
Owner

mikke89 commented Apr 26, 2023

Great, thank you for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backends Platforms and renderers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenGL backends & RmlUi should restore originally existing state after modification.
2 participants