From df9c3680999f26e189e7dfb21b0c00eb3446686a Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 25 Oct 2018 00:04:54 +0100 Subject: [PATCH] PUI: change alpha composition mode. This fixes the missing model-view text, but needs some wider testing, since it may mess up some other things. --- src/Viewer/PUICamera.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Viewer/PUICamera.cxx b/src/Viewer/PUICamera.cxx index 590db5fca..cee1b03ae 100644 --- a/src/Viewer/PUICamera.cxx +++ b/src/Viewer/PUICamera.cxx @@ -113,6 +113,9 @@ public: glPushAttrib(GL_ALL_ATTRIB_BITS); glPushClientAttrib(~0u); + glEnable ( GL_BLEND ) ; + glBlendFunc ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ) ; + // reset pixel storage stuff for PLIB FNT drawing via glBitmap glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); @@ -348,7 +351,9 @@ void PUICamera::init(osg::Group* parent) stateSet->setRenderBinDetails(1001, "RenderBin"); stateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::ON); stateSet->setTextureAttribute(0, _fboTexture); - stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA)); + + // use GL_ONE becuase we pre-multiplied by alpha when building the FBO texture + stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::ONE, osg::BlendFunc::ONE_MINUS_SRC_ALPHA)); stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); stateSet->setMode(GL_CULL_FACE, osg::StateAttribute::OFF); stateSet->setMode(GL_FOG, osg::StateAttribute::OFF);