I rendered the GUI via _injectRenderWithPass(...)
This function calls _setPass(...), wich never sets the Blendblock.
so I just added
Code: Select all
const Ogre::HlmsBlendblock *blendblock = mPass->getBlendblock();
mSceneMgr->getDestinationRenderSystem()->_setHlmsBlendblock(blendblock);
I was trying to implement ImGUI in Ogre 2.1, and got it nearly to work.
The only part missing is rendering alpha correctly.
If I understood right, the way to do it in 2.1 is setting the blendblock:
Code: Select all
Ogre::HlmsBlendblock blendblock(*mPass->getBlendblock());
blendblock.mSourceBlendFactor = Ogre::SBF_SOURCE_ALPHA;
blendblock.mDestBlendFactor = Ogre::SBF_ONE_MINUS_SOURCE_ALPHA;
blendblock.mSourceBlendFactorAlpha = Ogre::SBF_ONE_MINUS_SOURCE_ALPHA;
blendblock.mDestBlendFactorAlpha = Ogre::SBF_ZERO;
blendblock.mBlendOperation = Ogre::SBO_ADD;
blendblock.mBlendOperationAlpha = Ogre::SBO_ADD;
blendblock.mSeparateBlend = true;
blendblock.mIsTransparent = true;
mPass->setBlendblock(blendblock);
Code: Select all
mSceneMgr->_injectRenderWithPass(mPass, renderable, 0, false, false);
As I stepped through the source code of the rendering process I didn't saw the blendmode getting set anywhere either, but I could just have missed it.
Anyway, RenderDoc also shows the alpha getting written to the frameBuffer, but in the wrong way:
So the question is:
What's the correct way of doing it? Or is it a bug?
(note that I want to render it manually as the Gui Content may be changing every frame)