Font rendering with Cinder-NanoVG and Cinder-imGui


I’m compiling some code with both Cinder-NanoVG and Cinder-imGui blocks, but the font rendering in imGui became solid blocks as soon as NanoVG is rendering stuff.
Does any of you have any ideas on resolving this problem?



Check your blend mode. It should be set to alpha blending (or premultiplied alpha). Could be that NanoVG affects the OpenGL state, after which you have to reset it.


Literally just came across and fixed this issue a couple of hours ago. I just dumped this block after any call to nvgEndframe() and it seems to get GL back in sync with what cinder thinks is happening (at least enough to stop gl::context()->sanityCheck() from whinging.

    gl::ScopedVao vao { nullptr };
    gl::ScopedGlslProg shader { nullptr };
    gl::ScopedBlendPremult blend;        


@lithium.snepo, @paul.houx, thank you very much!!!
Adding gl::ScopedBlendPremult blend; can solve the problem.