Page 1 of 1

about NotifyDisplaysizeChanged in multiple window rendering

Posted: Mon Jan 19, 2015 05:36
by epsxk82
Hi,
I'm integrating CEGUI into our own 3D rendering engine.
a thing i'm getting stuck in now is how to deal with NotifyDisplaysizeChanged in multiple window rendering on our rendering engine(we call this multiple window rendering multiple channel rendering now).

Each channel owns a rendering context created with wglCreateContextAttribs.
On Each rendering frame, Each channel is bound using wglMakeCurrent.
I created a GUIContext per channel.
Here is a code snippet for rendering frame on multiple channel(window) rendering.
-----------------------------------------------------------------------------
RenderingEngine->setChannel(Channel1);
RenderingEngine->render(); -> GUIContext1->draw() is done here


RenderingEngine->setChannel(Channel2);
RenderingEngine->render(); -> GUIContext2->draw() is done here

RenderingEngine->setChannel(Channel3);
RenderingEngine->render(); -> GUIContext3->draw() is done here
-----------------------------------------------------------------------------

I think I need to notify window size to CEGUI per channel(maybe per GUIContext in my case) because each channel can highly have different window size.
But i can't find the way.
I tried to call CEGUI::System::GetSingleton()->notifyDislpySizeChanged on every RenderingEngine->render() call.
But I found it would take much overhead.

Re: about NotifyDisplaysizeChanged in multiple window render

Posted: Mon Jan 19, 2015 14:46
by Ident
I take it that your rendering engine is based on OpenGL.

You say you use multiple windows. What kind of "windows" are we talking about? Do they share an OpenGL context? Please tell me more about your setup.

Re: about NotifyDisplaysizeChanged in multiple window render

Posted: Mon Jan 26, 2015 02:49
by epsxk82
Here is the illustrative example.
Image

About the windows, those can be any kind of windows.
If in c++, those can be created with CreateWinodw from WINAPI.
If in c#, those can be the user control such as Panel, Form from WinForms or WPF Control such as Frame, Canvas From WPF.
Our rendering engine can render anywhere given the window handle.... even on the Desktop.

In Multiple window rendering. we share an OpenGL Context.

Re: about NotifyDisplaysizeChanged in multiple window render

Posted: Mon Jan 26, 2015 10:52
by Ident
I cannot see your image. Please try uploading it as attachment.

Ok so you meant "application windows" or "host windows". And you share an OpenGL context. The latter is definitely a good idea because otherwise CEGUI wouldn't work at all since textures etc couldnt be shared. GUIContexts can have different sizes. Without having tried it myself, I am surprised this does not work right away. This is likely a bug. It would be nice to be able to try this out but I have no simple way to reconstruct this scenario atm: I would first have to setup a glfw3 multi-window application with CEGUI. If you could provide us with a simple reconstruction, we can look into this sooner. Otherwise, for now I currently have no suggestions to resolve the issue, it is most likely a bug that might require quite some changes to CEGUI. I will look into it after my exam crunch time is over (~2 weeks), sorry I can't do it quicker, maybe another developer or user will have time to do it now.

Alternatively, if you want to look into it yourself (reading the CEGUI code and understanding and modifying it) you can ask us here or in the chat and we can maybe resolve the issue together, you can make a Pull Request with the fix then.

Re: about NotifyDisplaysizeChanged in multiple window render

Posted: Tue Jan 27, 2015 02:36
by epsxk82
I corrected the image URL.
The GUI Library used in the above example is Winforms basically given in Visual Studio.
In the example image above, the dialog is a form with 3 of child panels.
Our rendering engine is rendering in 3 channel way each rendering channel rendering on a separate panel.

As you can see the above image, the rendering works well.

My problem is this.

I looked into the System::notifyDisplaySizeChanged().
From this, i think the font size, and the image size is scaled by the factors given from this method.
And other factors such as event handling, input handling to widgets, also seem to be affected from this method call.

I need to give different font size, image size to each window channel separately because each window can have a different size.
So i think i need to notify each GUIContext of a display size separately(In my case, because each rendering channel is bound to a GUIContext).

I think i can handle this without changing the source code.
I think, Given i know completely what does System::notifyDisplaySizeChanged() do, I can make System::notifyDisplaySizeChanged()'s job done by separating out that job into the divided jobs done per a GUIContext instead of calling System::notifyDisplaySizeChanged().
If i'm right, could you tell me what i should do per a GUIContext instead of calling System::notifyDisplaySizeChanged().

Re: about NotifyDisplaysizeChanged in multiple window render

Posted: Tue Jan 27, 2015 08:57
by lucebac
The image is still broken...

But: why don't you look into the CEGUI source code? Everything is there and you can see what notifyDisplaySize does:
https://bitbucket.org/cegui/cegui/src/d ... 0-8#cl-582

Re: about NotifyDisplaysizeChanged in multiple window render

Posted: Thu Jan 29, 2015 21:00
by Ident
I think he already looked into it.

I am pretty sure what he wants is not possible without a modification to the function or even the overall system of rendering.