I found a nice person who ported the code to an earlier version of 2.1
https://bitbucket.org/ChaosCreator/imgu ... .1-binding
However, the 2.1 API has changed. I found dark_sylinc has made a helper class for this called PsoCacheHelper with some comments in there for usage, this was geared for Gorilla but imgui should be able to use it being an immediate gui.
So, referencing code in the above repo with the old 2.1 API, there's a class called ImguiManager where the tweaks are needed. I added a PsoCacheHelper to the class.
In Imgui::render, is where the fixes are needed.
Link to raw ImguiManager.cpp file HERE
This
Code: Select all
const Ogre::HlmsBlendblock *blendblock = mPass->getBlendblock();
const Ogre::HlmsMacroblock *macroblock = mPass->getMacroblock();
mSceneMgr->getDestinationRenderSystem()->_setHlmsBlendblock(blendblock);
mSceneMgr->getDestinationRenderSystem()->_setHlmsMacroblock(macroblock);
Code: Select all
const Ogre::HlmsBlendblock *blendblock = mPass->getBlendblock();
const Ogre::HlmsMacroblock *macroblock = mPass->getMacroblock();
//mSceneMgr->getDestinationRenderSystem()->_setHlmsBlendblock(blendblock);
//mSceneMgr->getDestinationRenderSystem()->_setHlmsMacroblock(macroblock);
mPSOCache->clearState();
/// @todo What do I put here????
mPSOCache->setRenderTarget(?);
mPSOCache->setMacroblock(macroblock);
mPSOCache->setBlendblock(blendblock);
This:
Code: Select all
//render the object
mSceneMgr->_injectRenderWithPass(mPass, mRenderables[i], 0, false, false);
Code: Select all
//render the object
//mSceneMgr->_injectRenderWithPass(mPass, mRenderables[i], 0, false, false);
// xtitus - changes for 2.1 rendering with PSO
Ogre::v1::RenderOperation renderOp;
mRenderables[i]->getRenderOperation(renderOp, false);
bool enablePrimitiveRestart = true; // is this right???
Ogre::VertexElement2VecVec vertexElements = renderOp.vertexData->
vertexDeclaration->convertToV2();
mPSOCache->setVertexFormat( vertexElements,
renderOp.operationType,
enablePrimitiveRestart );
Ogre::HlmsPso *pso = mPSOCache->getPso();
mSceneMgr->getDestinationRenderSystem()->_setPipelineStateObject( pso );
Thanks in advance for any help on this as I'm newer to using Ogre 2.1, been using Ogre 1.9 and lower for years...