Support Alpha blending in sokol_gl.h#1266
Open
danielchasehooper wants to merge 1 commit into
Open
Conversation
floooh
requested changes
May 20, 2025
| @@ -3331,6 +3331,9 @@ static void _sgl_init_context(sgl_context ctx_id, const sgl_context_desc_t* in_d | |||
| sg_pipeline_desc def_pip_desc; | |||
| _sgl_clear(&def_pip_desc, sizeof(def_pip_desc)); | |||
| def_pip_desc.depth.write_enabled = true; | |||
Owner
There was a problem hiding this comment.
It probably makes sense to remove this depth.write_enabled = true line when alpha-blending is enabled by default, and also remove this code in _sgl_init_pipeline() since it wouldn't have any purpose then:
Lines 3146 to 3148 in 202f41b
The rest of the default pipeline state is configured for 2D rendering anyway, which IMHO makes it ok to switch the default pipeline state to alpha blended (e.g. the common setup for rendering alpha-blended 2D sprites - which seems to be what sokol_gl.h is commonly used for)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sokol_gl's api accepts colors with alpha, so blending should probably be enabled