notlion / Cinder-NanoVG

A C++11 wrapper for NanoVG meant for use with Cinder
51 stars 15 forks source link

Font rendering with Cinder-imGui #11

Open origamidance opened 6 years ago

origamidance commented 6 years ago

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. screenshot_2017-12-13_03-21-58 Do you have any ideas on resolving this problem?

Best, origamidance.

notlion commented 6 years ago

NanoVG does modify some blend functions. There is a list of state touched in the NanoVG docs. I suppose this could be handled by the Cinder wrapper, but a quick fix would be to surround your calls to nvg::Context::endFrame() like this:

gl::ScopedGlslProg scopedProg(nullptr);
gl::ScopedVao scopedVao(nullptr);

mNvg.endFrame();

gl::disable(GL_BLEND);
gl::disable(GL_STENCIL_TEST);
glDisable(GL_BLEND);
glDisable(GL_STENCIL_TEST);