[Solved] OGRE writeContentsToFile() excludes CEGUI interface

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

[Solved] OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Thu Jul 14, 2016 12:34

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
Last edited by andrewc on Wed Jul 27, 2016 07:54, edited 1 time in total.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby YaronCT » Thu Jul 14, 2016 13:12

@andrewc: Which platform and which renderer inside Ogre?

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Thu Jul 14, 2016 13:18

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

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby YaronCT » Thu Jul 14, 2016 16:26

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

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Fri Jul 15, 2016 06:54

No problem. Thanks for your time so far.

Andrew

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby YaronCT » Sat Jul 16, 2016 13:27

@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?

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Tue Jul 26, 2016 07:31

@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:

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

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Tue Jul 26, 2016 07:44

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

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Tue Jul 26, 2016 08:10

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:
ssgui.png

What I'm getting from the writeContentsToFile() call:
ssnogui.png

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

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby YaronCT » Tue Jul 26, 2016 10:41

andrewc wrote:fat-fingered engineers
:rofl:

lucebac
Just can't stay away
Just can't stay away
Posts: 193
Joined: Sat May 24, 2014 21:55

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby lucebac » Tue Jul 26, 2016 14:49

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.

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby YaronCT » Tue Jul 26, 2016 22:32

@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?

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Wed Jul 27, 2016 06:34

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

andrewc
Just popping in
Just popping in
Posts: 16
Joined: Thu Jul 14, 2016 11:56

Re: OGRE writeContentsToFile() excludes CEGUI interface

Postby andrewc » Wed Jul 27, 2016 07:54

So, sticking in a call to:

Code: Select all

CEGUI::System::getSingleton().renderAllGUIContexts();
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

YaronCT
CEGUI Team
Posts: 448
Joined: Fri Jun 19, 2015 12:18
Location: Kiryat-Bialik, Israel

Re: [Solved] OGRE writeContentsToFile() excludes CEGUI interface

Postby YaronCT » Wed Jul 27, 2016 15:26

@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?)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 30 guests