[Solved] How to update rtt

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

fatmouse1984
Just popping in
Just popping in
Posts: 19
Joined: Tue Jun 10, 2014 11:20

[Solved] How to update rtt

Postby fatmouse1984 » Wed Dec 31, 2014 08:10

Hi everyone.

I have a window displaying texture rendered in ogre.
I set up the rtt according to this http://cegui.org.uk/wiki/Rendering_to_texture_(RTT)_in_CEGUI.
The texture can only be updated when i click on the window. :(
There should be a way to update texture every frame, i set "updatemode" to always, but nothing happen.
Image
I rotate ogre head in the main window, but nothing happen on cegui window.
Any help would be appreciated.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: How to update rtt

Postby Ident » Wed Dec 31, 2014 10:20

You do not need to do anything to update the RTT. If you updated the RTT on your gpu, then this same texture on the GPU will be displayed. Anything else is not possible anyways unless you cache the previous RTT somehow.

Therefore, more info would be appreciated: What window do you use to display the RTT? Do you use FrameWindows as parents? Do those FrameWindows have autorenderingsurface = true? If yes, does it work if you set it to false?
CrazyEddie: "I don't like GUIs"

fatmouse1984
Just popping in
Just popping in
Posts: 19
Joined: Tue Jun 10, 2014 11:20

Re: How to update rtt

Postby fatmouse1984 » Wed Dec 31, 2014 12:13

Hi Ident:

I use static image to display my RTT, it's parent is a FrameWindow.
After set autorenderingsurface of FrameWindow to false, the problem changed:
The image can be updated now, but i have to click on the window first.
If i change the underlying texture, i have to click on the window again, otherwise it still display previous texture.
I tried to change static image to image, the problem still exists. I guess it's still cashed somehow. :?

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: How to update rtt

Postby Ident » Wed Dec 31, 2014 13:01

Are there any more Windows as parents with AutoRenderingSurface = true? Have you checked all parents? Can we see your .layout?
Also i dont understand how the problem changed, sounds exactly the same to me.
CrazyEddie: "I don't like GUIs"

fatmouse1984
Just popping in
Just popping in
Posts: 19
Joined: Tue Jun 10, 2014 11:20

Re: How to update rtt

Postby fatmouse1984 » Wed Dec 31, 2014 13:24

After set autoRenderSurface of all parent to false, the image still won't be updated.
If i click on the window (only one time), the image can be updated from now on.
But if i change the underlying texture to another one at real time, i have to click on the window again( still one time),
otherwise it won't display the new texture.
So i call invalidate every time when i change the underlying texture to another one. It works fine now.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<GUILayout version="4" >
    <Window type="TaharezLook/FrameWindow" name="CompDebug" >
        <Property name="Area" value="{{0,0},{0,0},{0.4,0},{0.4,0}}" />
        <Property name="Text" value="Compositor debug" />
        <Property name="AspectMode" value="Expand" />
        <Property name="UpdateMode" value="Always" />
        <Property name="AlwaysOnTop" value="True" />
        <Property name="AutoRenderingSurface" value="False" />
        <Window type="TaharezLook/Combobox" name="combTex" >
            <Property name="Area" value="{{0.025,0},{0.05,0},{0.975,0},{1,0}}" />
            <Property name="ReadOnly" value="True" />
            <Property name="InheritsAlpha" value="False" />
            <AutoWindow namePath="__auto_editbox__" >
                <Property name="ReadOnly" value="True" />
                <Property name="ActiveSelectionColour" value="tl:FF6060FF tr:FF6060FF bl:FF6060FF br:FF6060FF" />
            </AutoWindow>
            <AutoWindow namePath="__auto_droplist__" >
                <AutoWindow namePath="__auto_hscrollbar__" >
                    <AutoWindow namePath="__auto_incbtn__" >
                        <Property name="RestoreOldCapture" value="True" />
                    </AutoWindow>
                    <AutoWindow namePath="__auto_decbtn__" >
                        <Property name="RestoreOldCapture" value="True" />
                    </AutoWindow>
                    <AutoWindow namePath="__auto_thumb__" >
                        <Property name="RestoreOldCapture" value="True" />
                    </AutoWindow>
                </AutoWindow>
                <AutoWindow namePath="__auto_vscrollbar__" >
                    <AutoWindow namePath="__auto_incbtn__" >
                        <Property name="RestoreOldCapture" value="True" />
                    </AutoWindow>
                    <AutoWindow namePath="__auto_decbtn__" >
                        <Property name="RestoreOldCapture" value="True" />
                    </AutoWindow>
                    <AutoWindow namePath="__auto_thumb__" >
                        <Property name="RestoreOldCapture" value="True" />
                    </AutoWindow>
                </AutoWindow>
            </AutoWindow>
        </Window>
        <Window type="WindowsLook/StaticImage" name="imgTex" >
            <Property name="Area" value="{{0.026992,0},{0.2,0},{0.977191,0},{0.960736,0}}" />
            <Property name="MaxSize" value="{{1,0},{1,0}}" />
            <Property name="UpdateMode" value="Always" />
            <Property name="InheritsAlpha" value="False" />
        </Window>
    </Window>
</GUILayout>

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>

<GUILayout version="4" >
    <Window type="DefaultWindow" name="Console" >
        <Property name="Area" value="{{0,-2},{0,0},{1,-2},{1,0}}" />
        <Property name="Font" value="GreatVibes-22" />
        <Property name="Alpha" value="0.8" />
        <Property name="MaxSize" value="{{1,0},{1,0}}" />
        <Property name="DistributeCapturedInputs" value="True" />
        <Window type="TaharezLook/StaticText" name="stPrompt" >
            <Property name="Area" value="{{0.005,0},{0.065,0},{1,0},{0.4,0}}" />
            <Property name="Font" value="DejaVuSansMono-12" />
            <Property name="MaxSize" value="{{1,0},{1,0}}" />
            <Property name="VertScrollbar" value="True" />
            <Property name="VertFormatting" value="TopAligned" />
            <Property name="BackgroundEnabled" value="False" />
            <Property name="HorzScrollPageSize" value="786" />
            <Property name="TextParsingEnabled" value="False" />
            <Property name="VertScrollPageSize" value="191" />
        </Window>
        <Window type="TaharezLook/StaticText" name="stBasic" >
            <Property name="Area" value="{{0.005,0},{0.405,0},{0.7,0},{1,0}}" />
            <Property name="Font" value="DejaVuSansMono-10" />
            <Property name="MaxSize" value="{{1,0},{1,0}}" />
            <Property name="HorzScrollbar" value="True" />
            <Property name="VertScrollbar" value="True" />
            <Property name="VertFormatting" value="TopAligned" />
            <Property name="BackgroundEnabled" value="False" />
            <Property name="HorzScrollPageSize" value="546" />
            <Property name="VertScrollPageSize" value="347" />
        </Window>
        <Window type="TaharezLook/StaticText" name="stChilds" >
            <Property name="Area" value="{{0.702,0},{0.405,0},{1,0},{1,0}}" />
            <Property name="Font" value="DejaVuSansMono-14" />
            <Property name="MaxSize" value="{{1,0},{1,0}}" />
            <Property name="HorzScrollbar" value="True" />
            <Property name="VertScrollbar" value="True" />
            <Property name="VertFormatting" value="TopAligned" />
            <Property name="BackgroundEnabled" value="False" />
            <Property name="HorzScrollPageSize" value="228" />
            <Property name="VertScrollPageSize" value="347" />
        </Window>
        <Window type="TaharezLook/Label" name="lblFps" >
            <Property name="Area" value="{{0.88,0},{0.005,0},{1,0},{0.06,0}}" />
            <Property name="Font" value="DejaVuSansMono-14" />
            <Property name="MaxSize" value="{{1,0},{1,0}}" />
            <Property name="HorzFormatting" value="RightAligned" />
        </Window>
        <Window type="TaharezLook/Editbox" name="editCmd" >
            <Property name="Area" value="{{0.005,0},{0.005,0},{0.75,0},{0.06,0}}" />
            <Property name="Font" value="DejaVuSansMono-14" />
            <Property name="BlinkCaret" value="True" />
            <Property name="UpdateMode" value="Always" />
        </Window>
        <Window type="Vanilla/Button" name="btnMaterial" >
            <Property name="Area" value="{{0.757813,0},{0.0138889,0},{0.78125,0},{0.0555556,0}}" />
            <Property name="Font" value="DejaVuSansMono-14" />
            <Property name="Text" value="M" />
        </Window>
        <Window type="Vanilla/Button" name="btnCompositor" >
            <Property name="Area" value="{{0.757813,79},{0.0138889,-1},{0.78125,79},{0.0555556,-1}}" />
            <Property name="Font" value="DejaVuSansMono-14" />
            <Property name="Text" value="C" />
        </Window>
        <Window type="Vanilla/Button" name="btnParticle" >
            <Property name="Area" value="{{0.757813,39},{0.0138889,-1},{0.78125,39},{0.0555556,-1}}" />
            <Property name="Font" value="DejaVuSansMono-14" />
            <Property name="Text" value="P" />
        </Window>
    </Window>
</GUILayout>


first layout is child of second layout

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: How to update rtt

Postby Ident » Wed Dec 31, 2014 13:34

Oh, now its clearer. Please show the code for changing to another texture.
CrazyEddie: "I don't like GUIs"

fatmouse1984
Just popping in
Just popping in
Posts: 19
Joined: Tue Jun 10, 2014 11:20

Re: How to update rtt

Postby fatmouse1984 » Wed Dec 31, 2014 13:38

Code: Select all

      TexturePtr ptrTex = TextureManager::getSingletonPtr()->getByName(realTexName);
      mpOgreTexture->setOgreTexture(ptrTex);
      mpimgTex->invalidate();

mpimgTex is the cegui window

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: How to update rtt

Postby Ident » Wed Dec 31, 2014 13:46

Yes in that case (changing the texture) you will have to invalide the CEGUI::Window. After all, the CEGUI window cannot know what Textures you have changed, because the Textures do not know where they are being used or how they are being used. Initially my understanding was that you had to invalidate everytime you rendered to the texture, which would make no sense, but now everything makes sense.
I will add an information on the wiki articles on this, thank you!
CrazyEddie: "I don't like GUIs"

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Solved] How to update rtt

Postby Ident » Wed Dec 31, 2014 14:46

Can you look over my changes at the bottom of the RTT displaying section?
http://cegui.org.uk/wiki/Rendering_to_t ... GUIContext
CrazyEddie: "I don't like GUIs"

fatmouse1984
Just popping in
Just popping in
Posts: 19
Joined: Tue Jun 10, 2014 11:20

Re: [Solved] How to update rtt

Postby fatmouse1984 » Thu Jan 01, 2015 02:08

Checked.
Right and clear.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: [Solved] How to update rtt

Postby Ident » Thu Jan 01, 2015 20:23

Thank you.
CrazyEddie: "I don't like GUIs"


Return to “Help”

Who is online

Users browsing this forum: No registered users and 24 guests