memononen / nanovg

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
zlib License
5.06k stars 767 forks source link

Disable blend for certain paths #638

Closed senxd closed 2 years ago

senxd commented 2 years ago

Is there a way to disable blending (glEnable/glDisable(GL_BLEND) for certain paths? I want to disable this for images

mulle-nat commented 2 years ago

The GL_BLEND is enabled in nanovg_gl.h#L1192, you could turn it off in the source code first, to see if that gives the desired effect. nvgEndFrame calls glnvg__renderFlush, via NVGparams. You'd have to hack something to make this configurable.

senxd commented 2 years ago

From what I saw, that is the only way. Thanks.

mulle-nat commented 2 years ago

My answer was just for technically disabling GL_BLEND, I think you can probably achieve the effect you want with nvgGlobalCompositeOperation or nvgGlobalCompositeBlendFuncSeparate.