Page 1 of 1

GUI disappearing when using alpha blending

Posted: Fri Jul 16, 2004 15:39
by Injector
Hello there,

I am happily using the gui system (with Ogre) for some days now and stumbled upon an issue:

Whenever I use a material with alpha blending enabled and an object using this material is visible, all GUI elements suddenly disappear. They reappear when the object using the respective material is culled...

I am a bit puzzled by that behaviour. All gui elements have an alpha setting of 1.0.

I am using the dotsceneoctree scene manager, i don't know if the behaviour can be related to that.

Any idea greatly appreciated.

Injector

GUI disappearing when using alpha blending

Posted: Fri Jul 16, 2004 19:18
by CrazyEddie
It must be missing state setting in the Ogre GUI renderer object :( I'll see if I can identify which setting is being missed and add it in (could be alpha testing or something silly like that).

I'll post back here when I've fixed it in CVS (may not be before Sunday). Thanks for the report :)

CE.

GUI disappearing when using alpha blending

Posted: Sat Jul 17, 2004 23:48
by CrazyEddie
Hi,

I will be looking at this tomorrow - sorry for the delay :(

I don't suppose you could put together a minimal demo that demonstrates the issue (so that I can test it and know when I've fixed the problem)?

If not don't worry too much, but the fix may take a little longer (as I'll need to find a way to reproduce the problem first!).

Thanks,

CE.

GUI disappearing when using alpha blending

Posted: Mon Jul 19, 2004 06:45
by Injector
Thanks for the reply.
I will try to compile a little demo later today.

Stay tuned.

GUI disappearing when using alpha blending

Posted: Mon Jul 19, 2004 09:41
by CrazyEddie
Thanks, that will be an enourmous help :)

GUI disappearing when using alpha blending

Posted: Mon Jul 19, 2004 12:45
by Injector
Ok, I modified the CameraTrack demo to include a simple message box (from one of your demos).

There are three files (case sensitive).

http://www.deck13.com/Ogre.material
http://www.deck13.com/CameraTrack.rar
http://www.deck13.com/Release.rar

I added the line "scene_blend alpha_blend" to the earrings material within Ogre.material. CameraTrack.rar contains the source code, Release.rar the binaries which are supposed to go in the common Ogre directory "Samples/Common/bin/Release" to make sure the app finds all materials, textures, etc. (Don't forget to put your Layout.tga in a place where Ogre can find it :D ). I updated Ogre and CEGUI from CVS this morning.
I hope rar's are ok for you and that this demo helps you finding the problem. If I have missed anything, let me know.

Thank you very much.

GUI disappearing when using alpha blending

Posted: Mon Jul 19, 2004 13:13
by CrazyEddie
Yep rar files are fine.

Thanks for doing this - definately a problem somewhere :lol: With any luck I'll have a solution in CVS tomorrow.

GUI disappearing when using alpha blending

Posted: Mon Jul 19, 2004 19:06
by CrazyEddie
This issue is now fixed. Thanks for reporting this, and for the demo - it was a great help :D

CVS has a 5 hour sync time for anonymous access, in the mean time see the patch below.

CE.

Code: Select all

Index: src/renderers/OgreGUIRenderer/ogrerenderer.cpp
===================================================================
RCS file: /cvsroot/crayzedsgui/cegui_mk2/src/renderers/OgreGUIRenderer/ogrerenderer.cpp,v
retrieving revision 1.13
diff -u -r1.13 ogrerenderer.cpp
--- src/renderers/OgreGUIRenderer/ogrerenderer.cpp   4 Jul 2004 10:27:18 -0000   1.13
+++ src/renderers/OgreGUIRenderer/ogrerenderer.cpp   19 Jul 2004 18:57:48 -0000
@@ -357,6 +357,7 @@
    d_render_sys->_setColourBufferWriteEnabled(true, true, true, true);
 
    // initialise texture settings
+   d_render_sys->_setTextureCoordCalculation(0, TEXCALC_NONE);
    d_render_sys->_setTextureCoordSet(0, 0);
    d_render_sys->_setTextureUnitFiltering(0, FO_LINEAR, FO_LINEAR, FO_POINT);
    d_render_sys->_setTextureAddressingMode(0, TextureUnitState::TAM_CLAMP);

GUI disappearing when using alpha blending

Posted: Tue Jul 20, 2004 11:05
by Injector
The fix indeed fixed the issue in the little demo I supplied, thanks for this.
Unfortunately, in my 'real' application, the problem was still there and here is why: I use vertex/fragment programs.

So without thinking about it too much I added the following two lines to the OgreRenderer::initRenderStates() method:

Code: Select all

d_render_sys->unbindGpuProgram(GPT_FRAGMENT_PROGRAM);
d_render_sys->unbindGpuProgram(GPT_VERTEX_PROGRAM);


and this seems to do the trick. :D

GUI disappearing when using alpha blending

Posted: Tue Jul 20, 2004 17:38
by CrazyEddie
Hehe :)

Thanks for this. I think it now has all the settings covered, at least I hope so. I'll add these calls to CVS in a little while :D