gd-imgui-cocos
gd-imgui-cocos copied to clipboard
Overriding Blend Function
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);