Unable to render QImage transparent on OGRE, When Transition from Qt 4.x to Qt5 with OGRE 1.8.0 to 1.11.6
-
I have upgraded my project from Qt4 to Qt5 and OGRE from 1.8.0 to 1.11.6. In Old version(Qt4 and OGRE 1.8.0) I am able to see 2D dimensions which I have render on OGRE view using following code but now I am unable to see 2D dimensions on OGRE view so I am not able to understand weather this issue is regarding Qt or OGRE. please suggest any solution
// Get the pixel buffer.
Ogre::HardwarePixelBufferSharedPtr pixelBuffer = mHudTexture->getBuffer(0,0);// Lock the pixel buffer and get a pixel box. pixelBuffer->lock(Ogre::HardwareBuffer::HBL_DISCARD); const Ogre::PixelBox& pixelBox = pixelBuffer->getCurrentLock(); Ogre::uint8* pDest = static_cast<Ogre::uint8*> (pixelBox.data); // Construct HUD image directly in the texture buffer. { // Create empty transparent image the size of the ogre window.
QImage hud(pDest, mHudTexture->getWidth(), mHudTexture->getHeight(), QImage::Format_ARGB32);
hud.fill(Qt::transparent);// Use a Qt QPainter to render to the ogre texture. QPainter painter(&hud);
-
Hi,
I can't answer this directly but did you saw that now Ogre officially provides Qt integration ? Did you check that ?
-
I have seen Qt integration. Only difference is that we are using base class as QWidget (because we had used Qt4.8.5 version and now we are using Qt 5.12.7) and In Qt integration they are suggested to use QWindow. Please suggest can I change QWindow by QWidget (For that I need to change all dependency).
-
Not directly but you can use QWidget::createWindowContainer.