Page 1 of 1

Background image on 3D GUI

Posted: Thu Feb 19, 2009 1:21 am
by Emiliano
Hi folks!
I need to display a fullscreen GUI (using CEGUI gadgets and windows) over a background image.
I know you can display sprites over CEGUI gadgets and windows, but how can you display gadgets and windows over an existing sprite?Is it possible to obtain a partial "transparency" effect as it seems implied by the ShowGUI command?
To explain further, take this little program:

Code: Select all

  ; GUI over background attempt
  InitEngine3D()
  InitSprite()
  InitSprite3D() 
  InitKeyboard()
  InitMouse()
  
  Add3DArchive("Data\"          , #PB_3DArchive_FileSystem)
  Add3DArchive("Textures\"          , #PB_3DArchive_FileSystem)
  Add3DArchive("GUI\", #PB_3DArchive_FileSystem)
  Add3DArchive("GUI\schemes", #PB_3DArchive_FileSystem)
  Add3DArchive("GUI\imagesets", #PB_3DArchive_FileSystem)
  Add3DArchive("GUI\fonts", #PB_3DArchive_FileSystem)
  Add3DArchive("GUI\looknfeel", #PB_3DArchive_FileSystem)
  Add3DArchive("GUI\layouts", #PB_3DArchive_FileSystem)
  
  OpenScreen(1024, 768, 32, "Test")
  background = LoadSprite(#PB_Any,"background.bmp",#PB_Sprite_Texture)
  background3D = CreateSprite3D(#PB_Any,background)
  CreateCamera(0,0,0,100,100)
  OpenWindow3D(0, 50, 50, 500, 400, "CEGUI over background")
  ButtonGadget3D(1, 60, 60, 100, 25, "Push me")
  
  ShowGUI(200,1)
  
  Repeat
    ExamineKeyboard() 
    If ExamineMouse()
      InputEvent3D(MouseX(),MouseY(),MouseButton(#PB_MouseButton_Left),KeyboardInkey())
    EndIf
    ; (a)
    ; displaysprite(background,0,0)
    RenderWorld()
    ; (b)
    ; displaysprite(background,0,0)
    FlipBuffers()
  Until KeyboardReleased(#PB_Key_Escape) Or WindowEvent3D()=#PB_Event3D_CloseWindow
The GUI works fine, without any background. Now if I uncomment (a), I obtain a blank screen. If I uncomment (b), obviously I see only the background image covering the whole GUI. The same if I use sprite3D instead of 2D sprites.
Anybody willing to help?
Thanks!

Posted: Fri Feb 20, 2009 5:08 pm
by Kaeru Gaman
as I heard so far, a picture beyond the 3D-World is no longer possible with the new OGRE version.
I guess the only way would be to use a Billboard in the far distance within the 3D-World.

Posted: Fri Feb 20, 2009 8:19 pm
by chris_b
What about a borderless Window3D the size of the screen with an ImageGadget3D for your background image?

Disable the window with DisableWindow3D() so it can't be brought in front of the other windows.

Posted: Fri Feb 20, 2009 9:04 pm
by Kaeru Gaman
I don't know, try it if you think it's meaningful...

Posted: Sat Feb 21, 2009 6:26 pm
by Emiliano
@chris_b
I actually already tried this solution, but it fails loading 1280x1024 or 1024x768 or even 512x512 textures.
As a matter of fact, the docs explicitly say to avoid textures larger than 256x256, which unfortunately are way too small for this kind of application.

@Kaeru Gaman
I am not an expert of 3D, but AFAIK the Billboard needs a Material, which in turn needs a Texture, and so we are sticky again with the 256x256 limit... Or I am missing something?

Thank you both for your advices.
It seems that Purebasic now sports a nice Gadget3D library, but still no fullscreen Gadget2D library...

Posted: Sat Feb 21, 2009 6:46 pm
by Kaeru Gaman
well, I don't know if the CEGUI routines need RenderWorld.
if not, you could easily leave it out and just put a background on your screen.

myself, I didn't test the CEGUI implementation yet, because I would prefer a completely selfmade GUI for 2D games.
I bet it's not more work than creating a completely new skin for CEGUI,
and using known skins on CEGUI in a selfmade game is ... dull

additionally, normally you don't need that much functionalities for a Game-GUI.

Buttons and Scrolltext is the most you need.
only few Games would need a Scrollbar, and there is the end of the row,
what more functionality should one need?

no reason to implement thousands of functionalities a windows-surface has for inside a game.

Posted: Wed Feb 25, 2009 4:12 pm
by Emiliano
I completely agree with you -- unfortunately I am not developing a game but rather a fullscreen application...
However, I was looking at SGX, which seems well done indeed: http://www.purebasic.fr/english/viewtopic.php?t=31357

Posted: Wed Feb 25, 2009 8:58 pm
by Kaeru Gaman
Emiliano wrote:... I am not developing a game but rather a fullscreen application...
did you think about rendering the screen-content in a maximized WindowedScreen and using standard windows and requesters?

Posted: Wed Apr 15, 2009 6:28 pm
by Emiliano
Thank you, I have done my project using SGX, which is failrly simple to modify and to understand -- e.g., I improved the Sprite gadget capability, added sound support, font coloring for buttons and text, additional controls and more stuff with little effort. I will post my modifications soon, after asking the original author first.
In comparison, after some study, I found myself really disliking CEGUI: it is overly complex and very convolute just to make a simple new 2D interface, requiring tons of different files, directories and obscure configuration files with an even more convolute documentation...
And above all, with SGX I can use DirectX9 together with 2D and 3D sprites and graphics, that is to say I can basically do anything with ease! ;)