gd-imgui-cocos icon indicating copy to clipboard operation
gd-imgui-cocos copied to clipboard

Overriding Blend Function

Open adafcaefc opened this issue 6 months ago • 0 comments

https://github.com/matcool/gd-imgui-cocos/blob/653e533c64597b64f7b96d523225b012bff5ea57/src/backend.cpp#L233

This function modifies the global OpenGL state, so if other rendering code expects a different blend mode, things may look broken, for example if any project using gd-imgui-cocos is rendered before GDHM code, the ImGui opacity will get messed up

maybe we can implement something like this?

GLint oldSrcBlend, oldDstBlend;
glGetIntegerv(GL_BLEND_SRC_ALPHA, &oldSrcBlend);
glGetIntegerv(GL_BLEND_DST_ALPHA, &oldDstBlend);

ccGLBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

... drawing

ccGLBlendFunc(oldSrcBlend, oldDstBlend);

adafcaefc avatar Apr 29 '25 16:04 adafcaefc