I give up! could someone be so kind and tell me how to set up sg pipeline to achieve a simple blending of transparent png as a texture quad ?
Jus like a simple glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) in opengl
https://learnopengl.com/img/advanced/blending_discard.png
This should do the trick (note the ".blend.enabled" flag:
sg_pipeline pip = sg_make_pipeline(&(sg_pipeline_desc){
.layout = ...,
.shader = ...,
.blend = {
.enabled = true,
.src_factor_rgb = SG_BLENDFACTOR_SRC_ALPHA,
.dst_factor_rgb = SG_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
},
});
sokol_gfx.h uses separate blend state for RGB and Alpha (similar to OpenGL's glBlendFuncSeparate), so it may also be required to set the .src_factor_alpha and .dst_factor_alpha members in sg_pipeline_desc, but usually this isn't needed when rendering to the default framebuffer.
That did the trick :) Thank's Floooh, you're awesome!
Most helpful comment
This should do the trick (note the ".blend.enabled" flag:
sokol_gfx.h uses separate blend state for RGB and Alpha (similar to OpenGL's glBlendFuncSeparate), so it may also be required to set the
.src_factor_alphaand.dst_factor_alphamembers in sg_pipeline_desc, but usually this isn't needed when rendering to the default framebuffer.