Problem with BlendState

Hi,

I've searched the forum for the answer and it contains quite a lot of discussion about correct usage of BlendState but none solves my problem:-(



On the attached image there is a wooden background, 3 buttons on top of it and black rectangle on top of it all.

All objects are Quads.



Background and buttons have loaded texture from .png file. These .png files are trasparent at some places - like the round corners of the buttons.



Black rectangle is just a Quad with black color diffuse material and it has 0.5f alpha…



Question is - why those buttons are not visible behind the rectangle whilst the background is???





BlendState used for background, buttons and rectangle (the same one for all):


 BlendState alphaState = DisplaySystem.getDisplaySystem().getRenderer().createBlendState();
 alphaState.setBlendEnabled(true);
 alphaState.setSourceFunctionAlpha(BlendState.SourceFunction.SourceAlpha);
 alphaState.setDestinationFunctionAlpha(BlendState.DestinationFunction.OneMinusSourceAlpha);
 alphaState.setTestEnabled(true);
 alphaState.setTestFunction(BlendState.TestFunction.GreaterThan);
 alphaState.setEnabled(true);         



Material for black rectangle:


quad.setDefaultColor(new ColorRBGA(0, 0, 0, 0.5f));//transparent black
MaterialState ms = DisplaySystem.getDisplaySystem().getRenderer().createMaterialState();
ms.setColorMaterial(ColorMaterial.Diffuse);
quad.setRenderState(ms);
quad.updateRenderState();



Thanks for any input or hints.. I have already tried some ideas from other thread.. like adding ZBufferState or setting render queue at Renderer.QUEUE_TRANSPARENT, but none worked for me so far...

Thanks..

does the texture have an alpha channel?

could be a problem there…

You mean those .png files?.. yes they have an alpha channel… buttons have rounded corners because the corners are transparent…

So, finally, I've solved it…

Problem was that I misused render queues… I put those buttons in Transparency queue even though they should be in opaque… I thought because they have texture which is transparent at some places they belong in transparent queue. But I was wrong… so I leave background and those buttons in default queue (INHERIT which resulted in SKIP in root node) and that black rectangle I put in transparent queue and it works now.

I must say I do not know how those render queues work or were intended to work, because when I put background and buttons in OPAQUE queue where I thought they belong, it was not good again:-(