[Solved] OGRE writeContentsToFile() excludes CEGUI interface
Moderators: CEGUI MVP, CEGUI Team
[Solved] OGRE writeContentsToFile() excludes CEGUI interface
Hello all,
I've been using CEGUI 0.8.7 with Ogre 1.9 to create a user interface for a simulation application for industrial tube-bending machines, and it's all working great apart from one small thing. I need to have functionality within the application to dump the window contents to a file, and want the CEGUI interface to be included in that, but when I call Ogre::RenderWindow::writeContentsToFile() all I get is the 3D scene without the GUI. Before using CEGUI I had a few simple 2D panels using the OgreBites SDKTrayManager and those were all visible in the output PNG file.
What do I need to do to have the CEGUI interface in the screenshot?
Thanks,
Andrew
I've been using CEGUI 0.8.7 with Ogre 1.9 to create a user interface for a simulation application for industrial tube-bending machines, and it's all working great apart from one small thing. I need to have functionality within the application to dump the window contents to a file, and want the CEGUI interface to be included in that, but when I call Ogre::RenderWindow::writeContentsToFile() all I get is the 3D scene without the GUI. Before using CEGUI I had a few simple 2D panels using the OgreBites SDKTrayManager and those were all visible in the output PNG file.
What do I need to do to have the CEGUI interface in the screenshot?
Thanks,
Andrew
Last edited by andrewc on Wed Jul 27, 2016 07:54, edited 1 time in total.
Re: OGRE writeContentsToFile() excludes CEGUI interface
@andrewc: Which platform and which renderer inside Ogre?
Re: OGRE writeContentsToFile() excludes CEGUI interface
Apologies for the missing information.
It's Windows 7, and the problem was noticed using Direct3D9. Your question prompted me to try it with OpenGL, and there it works fine, with the UI included in the screenshot.
Is there anything I can do to make it work with Direct3D9, which is our preferred renderer?
Cheers,
Andrew
It's Windows 7, and the problem was noticed using Direct3D9. Your question prompted me to try it with OpenGL, and there it works fine, with the UI included in the screenshot.
Is there anything I can do to make it work with Direct3D9, which is our preferred renderer?
Cheers,
Andrew
Re: OGRE writeContentsToFile() excludes CEGUI interface
@andrewc: I'll do my best to help u. Note, however, that there's been a flood of issues from users recently, and part of the cegui team is on vacation, so it may take time. Sorry.
Re: OGRE writeContentsToFile() excludes CEGUI interface
No problem. Thanks for your time so far.
Andrew
Andrew
Re: OGRE writeContentsToFile() excludes CEGUI interface
@andrewc: Do u use the same "Ogre::RenderTarget" for cegui and for your scene? Can u plz write the line that constructs the cegui ogre renderer in your project?
Re: OGRE writeContentsToFile() excludes CEGUI interface
@YaronCT: apologies for the late reply—like the CEGUI team I was on vacation myself last week!
Anyway, yes, unless I'm missing something it is the same render target.
The Ogre::RenderWindow is created in two different ways depending on settings:
or:
Regardless of that, the CEGUI Ogre renderer is created with this line of code:
And the screenshots are dumped thus:
Any and all further assistance much appreciated!
Andrew
Anyway, yes, unless I'm missing something it is the same render target.
The Ogre::RenderWindow is created in two different ways depending on settings:
Code: Select all
m_renderWindow = m_root->initialise(true, s_systemTitle);
or:
Code: Select all
Ogre::NameValuePairList opts;
// ... populate opts from config file settings ...
m_renderWindow = m_root->createRenderWindow(s_systemTitle, m_windowWidth, m_windowHeight, m_fullScreen, &opts);
Regardless of that, the CEGUI Ogre renderer is created with this line of code:
Code: Select all
m_ceguiRenderer = &CEGUI::OgreRenderer::bootstrapSystem(*m_renderWindow);
And the screenshots are dumped thus:
Code: Select all
m_renderWindow->writeContentsToFile(filename);
Any and all further assistance much appreciated!
Andrew
Re: OGRE writeContentsToFile() excludes CEGUI interface
Update regarding OpenGL: I just discovered that although the CEGUI user interface is present in the screenshot from OpenGL in full-screen mode, it is in fact absent in windowed mode. Using Direct3D9 it is absent in both full-screen and windowed mode.
Andrew
Andrew
Re: OGRE writeContentsToFile() excludes CEGUI interface
This probably won't give you any new information, but it's always good to have something to look at
Screenshot using Alt + PrtScn and pasting into Paint:
What I'm getting from the writeContentsToFile() call:
The slide-up GUI console is designed for XGA-spec industrial touch screens used by fat-fingered engineers on the factory floor, so please excuse its deliberately clunky and cheerful design!
Andrew
Screenshot using Alt + PrtScn and pasting into Paint:
What I'm getting from the writeContentsToFile() call:
The slide-up GUI console is designed for XGA-spec industrial touch screens used by fat-fingered engineers on the factory floor, so please excuse its deliberately clunky and cheerful design!
Andrew
Re: OGRE writeContentsToFile() excludes CEGUI interface
andrewc wrote:fat-fingered engineers
Re: OGRE writeContentsToFile() excludes CEGUI interface
Maybe, OGRE prints the screenshot before actually rendering CEGUI:
OGRE render scene [-> take screenshot] -> CEGUI render gui
Though, I'm not sure if OGRE calls all frame listeners before taking the screenshot or if it calls all frame listeners as the last step of its work.
OGRE render scene [-> take screenshot] -> CEGUI render gui
Though, I'm not sure if OGRE calls all frame listeners before taking the screenshot or if it calls all frame listeners as the last step of its work.
Re: OGRE writeContentsToFile() excludes CEGUI interface
@andrewc: Who owns the main loop? Do u call "Ogre::Root::startRendering" (and then Ogre controls it), or u control the main loop and call "Ogre::Root::renderOneFrame" to render each frame?
Re: OGRE writeContentsToFile() excludes CEGUI interface
My own code is controlling the main loop so that I can impose different arbitrary rates for simulation steps (typically 1000/s minimum) and rendered frames (60/s maximum). So I'm calling m_root->renderOneFrame() when it's time for each frame. Recall that it seems to work fine with OpenGL in fullscreen mode, so if the problem is due to ordering of events and calls, it's a subtle one.
Thanks for your attention so far!
Andrew
Thanks for your attention so far!
Andrew
Re: OGRE writeContentsToFile() excludes CEGUI interface
So, sticking in a call to: just before writeContentsToFile() seems to have done the trick.
I have to admit I'd not really given much consideration to when the CEGUI interface was being rendered, since it was all just happening automatically. Reading a few other threads on this forum gave me some useful pointers though. I'll now go through my code to see whether I can streamline the ordering of rendering calls—I'm getting nasty flashing and flickering of the CEGUI windows when dumping frames at a high rate for movie capture, which I take to be an indication that I'm probably making redundant calls.
Thanks for your help, for the moment.
Andrew
Code: Select all
CEGUI::System::getSingleton().renderAllGUIContexts();
I have to admit I'd not really given much consideration to when the CEGUI interface was being rendered, since it was all just happening automatically. Reading a few other threads on this forum gave me some useful pointers though. I'll now go through my code to see whether I can streamline the ordering of rendering calls—I'm getting nasty flashing and flickering of the CEGUI windows when dumping frames at a high rate for movie capture, which I take to be an indication that I'm probably making redundant calls.
Thanks for your help, for the moment.
Andrew
Re: [Solved] OGRE writeContentsToFile() excludes CEGUI interface
@andrewc: That hack is something I could have told u at the beginning, but I'm looking to really understand what's going on here. Who does the cegui rendering? Do u let the cegui renderer do it automatically (the default), or u do "CEGUI::System::getSingleton().renderAllGUIContexts()" somewhere? (and if so - where?)
Who is online
Users browsing this forum: No registered users and 30 guests