Steps to integrate ogre to hololens tutorial

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Posts: 38
Joined: Wed Dec 31, 2014 2:26 am

Steps to integrate ogre to hololens tutorial

Post by andreahmed » Wed Apr 26, 2017 7:22 pm

Hi All,

These are the changes to ogre3d.

1.You need to create a render target with texture array, so that ogre3d renders to left and right back buffer of hololens

mOgreRenderTexture[LeftEye] = Ogre::TextureManager::getSingleton().createManual("HoloLens Render Texture Left", "General", Ogre::TextureType::TEX_TYPE_2D_ARRAY, TextureWidth, TextureHeight,2,1, Ogre::PixelFormat::PF_BYTE_BGRA, Ogre::TextureUsage::TU_RENDERTARGET );

2.You need to set the render target texture of the camera holo lens right and left to ogre3d text2d member variable, so that ogre renders to it

Add the following function in OGreD3D11Texture header file:

virtual void SetTexture(ID3D11Texture2D *pTexture )
mp2DTex = pTexture;
_queryInterface<ID3D11Resource, ID3D11Texture2D>(mpTex, &mp2DTex);


3. In Camera resources, you need to grap the texture each frame so that ogre renders to camera back buffer, You need to change the rebind function so that its visible to the Render Target class

Ogre::TexturePtr * ogreTexture = mOgreContentRenderer->getTextures();
Ogre::HardwarePixelBufferSharedPtr buffer = ogreTexture[LeftEye]->getBuffer(0);

Ogre::HardwarePixelBufferSharedPtr buffer1 = ogreTexture[LeftEye]->getBuffer(0,1);
((Ogre::D3D11HardwarePixelBuffer*)buffer.get())->getParentTexture()->SetTexture(cameraBackBuffer.Get(), &ogreTexture[LeftEye], 0);
((Ogre::D3D11HardwarePixelBuffer*)buffer1.get())->getParentTexture()->SetTexture(cameraBackBuffer.Get(), &ogreTexture[LeftEye], 0);




mOgreContentRenderer->getRoot()->getRenderSystem()->_setRenderTarget(ogreTexture[LeftEye]->getBuffer(0, 1)->getRenderTarget(1));


5. While creating a hardware pixel buffer, change the function so that it doesn't divide the width/height by 2, and set mimap to 0


if(width > 1) width /= 1;
if(height > 1) height /= 1;

This is to create a matched hardware pixel buffer with the camera back buffer.
0 x

Posts: 263
Joined: Fri Dec 04, 2009 6:02 pm

Re: Steps to integrate ogre to hololens tutorial

Post by arkeon » Tue Jun 13, 2017 11:22 pm

It could be useful thanks!
0 x
OpenSpace 3D Project manager

Posts: 3
Joined: Tue Jun 20, 2017 4:13 pm

Re: Steps to integrate ogre to hololens tutorial

Post by VY_Holo » Tue Jun 20, 2017 4:21 pm

Hi andreahmed,

I'm also trying to integrate Ogre with hololens. I've not understand all your changes.

- mOgreRenderTexture : What is the type/class of this object ?
- How did you managed to initialize the holographic Space and OgreContentWindow ? Some people (as me) have problem with that (
0 x

Post Reply