Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Steps to integrate ogre to hololens tutorial

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);

}

  1. 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);

ogreTexture[LeftEye]->getBuffer()->getRenderTarget(0)->rebind((Ogre::D3D11HardwarePixelBuffer*)buffer.get());

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

ogreTexture[LeftEye]->getBuffer(0,1)->getRenderTarget(1)->rebind((Ogre::D3D11HardwarePixelBuffer*)buffer1.get());

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

mOgreContentRenderer->getRoot()->renderOneFrame();

  1. 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

mSurfaceList.push_back(HardwarePixelBufferSharedPtr(buffer));

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

This is to create a matched hardware pixel buffer with the camera back buffer.
andreahmed
Gnoblar

Posts: 13
Kudos: 0
Joined: 31 Dec 2014
Top

Answers

  • Options

    Hi,

    I'm also trying to integrate Ogre3D in Hololens. I don't really understand what you've explained.

    By example, "1.You need to create a render target with texture array, so that ogre3d renders to left and right back buffer of hololens", ok, but where ?

Sign In or Register to comment.