GUI redraw after app window size change

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

User avatar
Ben811
Just popping in
Just popping in
Posts: 14
Joined: Wed Nov 23, 2005 09:33

GUI redraw after app window size change

Postby Ben811 » Tue Oct 06, 2009 07:25

Hi there,

I'm using CEGUI with Ogre and just tried to port to the 0.7.0 version of CEGUI. As I have read so far there are some changes to the "'inner rect' fixes made for 0.7.0". As I don't run the SVN version for now, maybe this might be solved when switching to it.
My bigger problem appears when I resize my application window. With the 0.7 version and the new renderer model 2.0 I need to get CEGUI to redraw all windows. The only way I get this done now is by iterating through the window tree and change the size slightly. But this resizing takes about 15 seconds (a complete app hang)...

Code: Select all

void TV3D_GUI::resizeChildWindows( CEGUI::Window* pkWindow )
{
   if( pkWindow )
   {
      CEGUI::UVector2 vec( CEGUI::UDim( 1.0f, 0 ), CEGUI::UDim( 1.0f, 0 ) );
      vec = pkWindow->getSize();
      vec += CEGUI::UVector2( CEGUI::UDim( 0.0f, 0.0001f ), CEGUI::UDim( 0.0f, 0.0001f ) );
      pkWindow->setSize( vec );

      for( int nChildIndex = 0; nChildIndex < pkWindow->getChildCount(); nChildIndex++ )
      {
         resizeChildWindows( pkWindow->getChildAtIdx( nChildIndex ) );
      }
   }
}


I have already tried other solutions like:

Code: Select all

pkWindow->getRenderingSurface()->invalidate();

or

Code: Select all

pkWindow->getGeometryBuffer()->reset();


but none of them seems to have an effect.

Can someone tell me what I am doing wrong?

Cheers, Ben

Some more detailed info. This is what Ogre does:

!!! Direct3D Device Lost!
Releasing D3D9 default pool texture: Video3
Released D3D9 default pool texture: Video3
... Releasing a lot of stuff ...
D3D9TextureManager released:
16 unmanaged textures
D3D9HardwareBufferManager released:
794 unmanaged vertex buffers
0 unmanaged index buffers
Reset device ok w:905 h:794
D3D9 : WARNING - disabling VSync in windowed mode can cause timing issues at low
er frame rates, turn VSync on if you observe this problem.
Recreating D3D9 default pool texture: Video3
Recreated D3D9 default pool texture: Video3
... Recreating a lot of stuff ...
D3D9TextureManager recreated:
16 unmanaged textures
D3D9HardwareBufferManager recreated:
794 unmanaged vertex buffers
0 unmanaged index buffers
!!! Direct3D Device successfully restored.


This is how the GUI looks after the first start. The window content is moved from the tilebar and outer window frame. After moving the window once this gets fixed:

Image

This is how the GUI looks after resizing and doing nothing (in fact I have done two mouse clicks to see something at all...):

Image

This is how the GUI looks (and how it finally should look like) after resizing and using the setSize code from above (with 15 seconds delay!):

Image

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: GUI redraw after app window size change

Postby CrazyEddie » Tue Oct 06, 2009 08:53

Hi,

In respect of the first screenshot issue - it may be related to an issue regarding absolute positioning of windows, this is fixed in the v0-7 svn branch, so may well fix your issue (can't be sure without more info - like an minimal example layout to test)

With regards to the window resize, you have to inform the CEGUI system about the host window size change by calling the CEGUI::System::notifyDisplaySizeChanged function - previously you would have been calling a similar function on the Renderer object; this call should now be removed (since the CEGUI::System call will inform the Renderer for you).

HTH

CE.

User avatar
Ben811
Just popping in
Just popping in
Posts: 14
Joined: Wed Nov 23, 2005 09:33

Re: GUI redraw after app window size change

Postby Ben811 » Fri Oct 09, 2009 19:06

Hi CrazyEddie,

well I have tried a lot of calls and also debugged through the CEGUI::System::notifyDisplaySizeChanged but this does not change the behavior.
My GUI resize function right now calls:

m_pkCEGUI_System->notifyDisplaySizeChanged( CEGUI::Size( nWidth, nHeight ) );
CEGUI::MouseCursor::getSingleton().setConstraintArea( 0 );
resizeChildWindows( m_pkCEGUI_Window );

The resizeChildWindows function is shown in the previos post. When commenting this line the redraw does not take place.

Here is a sample layout, I removed a lot of sub windows to make it shorter...

Thanks for any further help,

Ben


Code: Select all

<GUILayout >
    <Window Type="3DmeetsTVLook/FrameWindow" Name="GUI_Website" >
        <Property Name="Text" Value="Website properties" />
        <Property Name="Alpha" Value="0.75" />
        <Property Name="TitlebarFont" Value="Tahoma-10" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Property Name="TitlebarEnabled" Value="True" />
        <Property Name="UnifiedAreaRect" Value="{{0,-120},{0,0},{0,283},{0,822}}" />
        <Property Name="HorizontalAlignment" Value="Right" />
        <Window Type="3DmeetsTVLook/StaticImage" Name="GUI_Website/Frame/Websites" >
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0.0222027,0},{0,37},{0.982202,0},{0,427}}" />
            <Window Type="3DmeetsTVLook/StaticText" Name="GUI_Website/Frame/Configuration/" >
                <Property Name="Text" Value="Configuration" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.0183755,0},{0.05,22},{0.97838,0},{0.05,53}}" />
                <Window Type="3DmeetsTVLook/Button" Name="GUI_Website/Button/Load" >
                    <Property Name="Text" Value="Load" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0.421524,0},{0,4},{0.641524,0},{0,29}}" />
                </Window>
                <Window Type="3DmeetsTVLook/Button" Name="GUI_Website/Button/Save" >
                    <Property Name="Text" Value="Save" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0.694745,0},{0,3},{0.914745,0},{0,28}}" />
                </Window>
            </Window>
            <Window Type="3DmeetsTVLook/Button" Name="GUI_Website/Button/Show" >
                <Property Name="Text" Value="Show" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.0360612,0},{0,295},{0.256061,0},{0,320}}" />
            </Window>
            <Window Type="3DmeetsTVLook/Button" Name="GUI_Website/Button/Hide" >
                <Property Name="Text" Value="Hide" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.299005,0},{0,295},{0.519005,0},{0,320}}" />
            </Window>
        </Window>
        <Window Type="3DmeetsTVLook/StaticImage" Name="GUI_Website/Frame/Properties" >
            <Property Name="Text" Value="Test" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="UnifiedAreaRect" Value="{{0.02,0},{0,433},{0.98,0},{0,810}}" />
            <Window Type="3DmeetsTVLook/Checkbox" Name="GUI_Website/Checkbox/Gadjet" >
                <Property Name="AlwaysOnTop" Value="True" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="UnifiedAreaRect" Value="{{0.426461,0},{-0.277894,0},{0.475114,0},{-0.200808,0}}" />
                <Property Name="VerticalAlignment" Value="Centre" />
                <Property Name="HorizontalAlignment" Value="Centre" />
            </Window>
            <Window Type="3DmeetsTVLook/StaticText" Name="GUI_Website/Text/Gadjet" >
                <Property Name="Text" Value="Google gadjet (&lt;script&gt;), object or ... tag:" />
                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                <Property Name="VertFormatting" Value="TopAligned" />
                <Property Name="UnifiedAreaRect" Value="{{0.0206498,0},{0,71},{0.977705,0},{0,187}}" />
                <Window Type="3DmeetsTVLook/MultiLineEditbox" Name="GUI_Website/MultiLineEditbox/Gadjet" >
                    <Property Name="Text" >
</Property>
                    <Property Name="MaxTextLength" Value="1073741823" />
                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                    <Property Name="UnifiedAreaRect" Value="{{0.0191393,0},{0.220481,0},{0.979263,0},{0.895631,0}}" />
                </Window>
            </Window>
        </Window>
    </Window>
</GUILayout>

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: GUI redraw after app window size change

Postby CrazyEddie » Sat Oct 10, 2009 12:34

Hi,

I can now confirm the issues described are bugs in CEGUI, these should get fixed later today.

CE.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: GUI redraw after app window size change

Postby CrazyEddie » Sat Oct 10, 2009 17:54

Turns out there are multiple issues at work here, so it's going to take a bit longer while I ensure we get the "right" fix (plus I don't want to spend all evening, night and into the early hours working on CEGUI again).

As an aside, I've retested with the 0.6.x code and it appears there are some similar issues in there too, which is a little hard for me to explain (though they're unlikely to get fixed in that branch), hence the delays while things get investigated properly ;)

CE.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: GUI redraw after app window size change

Postby CrazyEddie » Sun Oct 11, 2009 16:46

Ok. I have committed a batch of changes and fixes that should address all issues with regards to content positioning and content updates due to host window / display size changes and imageset imagery size changes. These mods are all in the v0-7 svn branch.

CE.

User avatar
Ben811
Just popping in
Just popping in
Posts: 14
Joined: Wed Nov 23, 2005 09:33

Re: GUI redraw after app window size change

Postby Ben811 » Mon Oct 12, 2009 09:41

Hi CE,

I have done some tests with the latest SVN release and this seems to cure all my problems after rebuilding all my dialogs with the help of CELayoutEditor (In fact I have only tried rebuilding one but this had worked).

Thanks for your quick help...

Ben

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: GUI redraw after app window size change

Postby CrazyEddie » Mon Oct 12, 2009 10:57

Thanks for confirming that the issues appear to be fixed :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests