[SOLVED]GUI transparency

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

Rampage
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 03, 2011 14:18

[SOLVED]GUI transparency

Postby Rampage » Tue Jul 05, 2011 11:15

Hello, i have a problem with gui transaprency. When i have rendering enabled with

Code: Select all

CEGUI::System::getSingleton().renderGUI()
All my other objects are not visible. When i change my default fulscreen window property to not visible,all child gui windows disapear, but i have only empty screen without my objects. When i comment code to render gui, all my objects are visible correctly. How it is possible?
Last edited by Rampage on Mon Jul 11, 2011 07:17, edited 1 time in total.

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: GUI transparency

Postby Kulik » Tue Jul 05, 2011 12:11

This post is lacking lots of information, as you are new I am not gonna downvote you but please read the guidelines. It's impossible to help using the info you provided.

Rampage
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 03, 2011 14:18

Re: GUI transparency

Postby Rampage » Wed Jul 06, 2011 08:46

So, again, i read all the documents to cegui.

i init with

Code: Select all

        CEGUI::Direct3D9Renderer::bootstrapSystem(m_pDirect3DDevice);

   // initialise the required dirs for the DefaultResourceProvider
   CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());
 
   rp->setResourceGroupDirectory("schemes", "datafiles/schemes/");
   rp->setResourceGroupDirectory("imagesets", "datafiles/imagesets/");
   rp->setResourceGroupDirectory("fonts", "datafiles/fonts/");
   rp->setResourceGroupDirectory("layouts", "datafiles/layouts/");
   rp->setResourceGroupDirectory("looknfeels", "datafiles/looknfeel/");
   rp->setResourceGroupDirectory("lua_scripts", "datafiles/lua_scripts/");
 
   // set the default resource groups to be used
   CEGUI::Imageset::setDefaultResourceGroup("imagesets");
   CEGUI::Font::setDefaultResourceGroup("fonts");
   CEGUI::Scheme::setDefaultResourceGroup("schemes");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
   CEGUI::WindowManager::setDefaultResourceGroup("layouts");
   CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");

   // load in the scheme file, which auto-loads the TaharezLook imageset
   CEGUI::SchemeManager::getSingleton().create( "TaharezLook.scheme" );

   // load in a font. The first font loaded automatically becomes the default font.
   CEGUI::FontManager::getSingleton().create( "DejaVuSans-10.font" );

   CEGUI::System::getSingleton().setDefaultFont( "DejaVuSans-10" );
   CEGUI::System::getSingleton().setDefaultMouseCursor( "TaharezLook", "MouseArrow" );
   
   m_wndRoot = CEGUI::WindowManager::getSingleton().loadWindowLayout( "submarine.layout" );
   CEGUI::System::getSingleton().setGUISheet( m_wndRoot );
   //CEGUI::System::getSingleton().getGUISheet()->hide();

   //subscribing events here      


then i render it in func

Code: Select all

        m_pDirect3DDevice->BeginScene();
   
   //drawing all objects here
   // draw GUI
   CEGUI::System::getSingleton().renderGUI();
   m_pDirect3DDevice->EndScene();


my xml.layout looks loke

Code: Select all

<Window Type="DefaultWindow" Name="wndRoot" >
    <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    <Property Name="Alpha" Value="0" />
    <Property Name="AlwaysOnTop" Value="False" />
    <Window Type="TaharezLook/FrameWindow" Name="wndMenu" >
      <Property Name="InheritsAlpha" Value="False" />
      <Property Name="Visible" Value="True" />
      <Property Name="Font" Value="DejaVuSans-10" />
      <Property Name="AlwaysOnTop" Value="True" />
      <Property Name="TitlebarFont" Value="DejaVuSans-10" />
      <Property Name="RollUpEnabled" Value="False" />
      <Property Name="TitlebarEnabled" Value="True" />
      <Property Name="UnifiedPosition" Value="{ {0.25, 0}, {0.25, 0} }" />
      <Property Name="UnifiedSize" Value="{ {0.5, 0}, {0.5, 0} }" />
      <Property Name="DragMovingEnabled" Value="False" />
      <Property Name="CloseButtonEnabled" Value="False" />
      //some other subwindows
      </Window>
    </Window>



When i comment line with cegui::render() in rendering func, all my objects are shown correctly, when the line is not commented only gui is visible. My directX objects rendering methods allways return success. When i hide my gui sheet with hide() method, the gui is hidden, but my objects are again not visible.

I think there has to be a problem with default window transparency, or somethink like that.

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

Re: GUI transparency

Postby CrazyEddie » Thu Jul 07, 2011 18:59

CEGUI does not save and restore the D3D states, so you should do that around the call the System::renderGUI.

CE.

Rampage
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 03, 2011 14:18

Re: GUI transparency

Postby Rampage » Sun Jul 10, 2011 12:52

CrazyEddie wrote:CEGUI does not save and restore the D3D states, so you should do that around the call the System::renderGUI.

CE.



Hmm, how should i do that please? I am really desparate.

I dont know exactly, what you thik. If it is testing this

Code: Select all

//check device
   bool ret = true;
   switch(m_pDirect3DDevice->TestCooperativeLevel())
   {
   case D3DERR_DEVICELOST:
      ret = false;
      break;
   case D3DERR_DEVICENOTRESET:
      {
         m_font->OnLostDevice();
         //reset device
         if(FAILED(m_pDirect3DDevice->Reset(&m_PresentParameters)))
         {
            assert(false);
            SMCLog::DebugPrint("[GUI]","Reset() failed!");
            ret = false;
            break;
         }

         //init scene again
         InitScene();
         m_font->OnResetDevice();
      }
      break;
   }
   return ret;


This code i allready have implemented


So what are the possibilities that can happen? why cant i see my objects when gui is shown? I really cant get it... . Is there any code i can provide, that you can help me?

When i have empty gui.layout file, so i am rendering only mouse cursor, my objects are also hidden. There have to be init errors or something.i cant uderstand this sitation


EDIT: i found out, when i comment all the gui code, except bootstrapsystem() and renderGUI() my objects are still invisible.. How is that possible?

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: GUI transparency

Postby Kulik » Sun Jul 10, 2011 16:25

You have to save the D3D state before renderGUI is called, then restore it when renderGUI is finished. In many cases this is not needed because the rendering code sets everything up every frame (this is more or less a standard I would say).

Googling for D3D state save and restore will get you a long way. There also was a thread not long ago discussing this.

MarkR
Quite a regular
Quite a regular
Posts: 64
Joined: Thu Jul 15, 2010 06:55

Re: GUI transparency

Postby MarkR » Mon Jul 11, 2011 06:37

This thread contains the rendering part of the ts3 overlay, which works with nearly(?) all d3d9 games.
It stores the rendering state for the underlying application and also sets a senseful default state for the CEGUI.
Not the most efficient if you know what the application is doing, but at least it should work.
You may strip down the solution after you have confirmed that this solves your problem.

viewtopic.php?f=10&t=5594&p=26655#p26655

Rampage
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 03, 2011 14:18

Re: GUI transparency

Postby Rampage » Mon Jul 11, 2011 07:16

thx to all, the state saving and refreshing solved my problem.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 12 guests