HELP! Rendering Problem when integrating CEGUI with TV3D

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

notapro
Just popping in
Just popping in
Posts: 2
Joined: Mon Apr 10, 2006 17:44

HELP! Rendering Problem when integrating CEGUI with TV3D

Postby notapro » Tue Apr 11, 2006 04:31

Hello. I'm new to this forum and I'm a newbie in CEGUI. I know that this post is quite long, but I was trying to make it as clear as possible. Hope that you guys can read it.

Recently I have successfully integrated CEGUI with Truevision3D(a DirectX 8 3D Game Engine). The way I do it (conceptually) is as follows :-
1) Get the Direct3D device used by Truevision3D (the function is provided in the game engine).
2) Use the Direct3D device to create a DirectX 8.1 renderer for CEGUI. I also create a CEGUI System object using the renderer created previously.
3) initialize the content of my GUI interface using CEGUI
4) render the interface using CEGUI System's renderGUI() before the buffer being swapped.

Everything runs fine (my CEGUI interface run on top of Truevision3D), BUT the order of rendering for Truevision3D mess up. The meshes that should be at the back was rendered in front of the meshes that are closer to the camera. When I comment the renderGUI() code and run it, the rendering order for Truevision3D is working correctly again. I have looked at the CEGUI logfile but I found no errors.

So in the end I examine my codes and experiment things here and there. I found that when I used renderGUI(), it changes the Truevision3D rendering order in such a way that the first 3D object created will be rendered first without considering the Z value.

Although I do not know whether it will work or not, but the only solution in my mind is to create a new Direct3D device for CEGUI, but let the newly created Direct3D device to draw on the back buffer of Truevision3D. Truevision3D do provide a function for me to get the back buffer surface of Truevision3D, but with my limited knowledge in DirectX, I do not know how to assigned the back buffer to the newly created Direct3D device.

I hope that you great people out there can help me out with this. Thanks in advance.
Life is like sine wave where it has many ups and downs.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 11, 2006 15:28

the CEGUI DX renderers change the D3D state, and does not set it back as this apparently cannot be done efficiently.
So you might be seeing a messed up state. You'll need to make sure you restore the D3D states after renderGUI.

HTH

notapro
Just popping in
Just popping in
Posts: 2
Joined: Mon Apr 10, 2006 17:44

Postby notapro » Wed Apr 12, 2006 02:17

Yeah!!! :D

Thank you for your help. It really worth a MILLION !!!!

What I did was I re-enabled the z-buffering after the renderGUI() call....

Code: Select all

System::getSingleton().renderGUI();
pD3Ddevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);


....and after that everything works fine....

Thanks again, lindquist !!!! :D
Life is like sine wave where it has many ups and downs.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests