How to get a windowless application in Ogre?

I am trying to create an Ogre windowless application, but it seems that the RenderWindow :: setVisible (false) method is completely ignored by the application. Is there any way to do this?

Thanks
Tommaso

+3
source share
2 answers

You should not use RenderWindow, but RenderTextureif you do not want to open a window. It works almost exactly the same as RenderWindowbecause it is also sourced from RenderTarget. You will have almost no problems switching them with the current parameters, except for changing the constructor.

Please update your question with specific code if you encounter problems with the switch.

+8

, , , . Ogre RenderWindow (window = m_root->initialise(true, "App")) Ogre 1.8 , window->setHidden(true) " ".

, RenderTexture. :

m_window = m_root->initialise(true, "App");
m_window->setHidden(true);
Ogre::WindowEventUtilities::messagePump(); // Force the window to be hidden (necessary under Ubuntu for my case)

m_camera = m_sceneMgr->createCamera("Cam");

Ogre::TexturePtr rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex",
                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                Ogre::TEX_TYPE_2D, 640, 480, 0,
                Ogre::PF_R8G8B8,
                Ogre::TU_RENDERTARGET);

Ogre::RenderTexture* m_tex = rtt_texture->getBuffer()->getRenderTarget();
Ogre::Viewport* vp = m_tex->addViewport(m_camera);
vp->setClearEveryFrame(true);
vp->setBackgroundColour(Ogre::ColourValue::Black);
vp->setOverlaysEnabled(false);
m_camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));

RenderLoop:

while(1)
{
  m_root->renderOneFrame();
  m_tex->update();

  // Other stuffs
}
0

Source: https://habr.com/ru/post/1735803/


All Articles