Problem with transparency in GLWindow

classic Classic list List threaded Threaded
5 messages Options
adi
Reply | Threaded
Open this post in threaded view
|

Problem with transparency in GLWindow

adi
Hi

I use transparent objects in my GLWindow with the blend function:
gl.glEnable(GL4bc.GL_BLEND);
gl.glBlendFunc( GL4bc.GL_SRC_ALPHA, GL4bc.GL_ONE_MINUS_SRC_ALPHA );

For alpha value 1.0f the object is opaque and for alpha value 0.0f it is unvisible. That is ok.
For alpha values between zero and one, the object is transparent, what is also
correct. The Problem is, i want only see the background in my GLWindow, but not the
background behind the GLWindow.(e.g. my code in eclipse or the desktop).

Is GLWindow the correct selection for using transparency, or must i change
to a separate display mode??
     
 
Reply | Threaded
Open this post in threaded view
|

Re: Problem with transparency in GLWindow

Sven Gothel
Administrator
On 11/18/2012 11:28 PM, adi [via jogamp] wrote:

> Hi
>
> I use transparent objects in my GLWindow with the blend function:
> gl.glEnable(GL4bc.GL_BLEND);
> gl.glBlendFunc( GL4bc.GL_SRC_ALPHA, GL4bc.GL_ONE_MINUS_SRC_ALPHA );
>
> For alpha value 1.0f the object is opaque and for alpha value 0.0f it is
> unvisible. That is ok.
> For alpha values between zero and one, the object is transparent, what is also
> correct.
Ok.

> The Problem is, that i want see the background in my GLWindow, but
> not the
> background behind the GLWindow.(e.g. my code in eclipse or the desktop).

I don't understand this statement properly I am afraid, so double checking:

You want to see the GLWindow background ( == opaque)
and not 'things' behind the GLWindow ( == !opaque == translucent ) ?

In such case, you should simply leave GLCapabilities
opaque == true (default) value.
For translucency you set it to false.

Note: There is a known bug w/ some version of Mesa3D using RGBA and opaque,
where the GLWindow becomes translucent, regardless of the opaque settings.

>
> Is GLWindow the correct selection for using transparency, or must i change
> to a separate display mode??

.. see above, for clarifying the question.

Maybe also try the unit test / demo TestGearsES2NEWT,
see it's commandline options where you can toggle some modes manually.

~Sven



signature.asc (909 bytes) Download Attachment
adi
Reply | Threaded
Open this post in threaded view
|

Re: Problem with transparency in GLWindow

adi
Hi Sven

The problem is, if i use this code

gl.glEnable(GL4bc.GL_BLEND);
gl.glBlendFunc( GL4bc.GL_SRC_ALPHA, GL4bc.GL_ONE_MINUS_SRC_ALPHA );

and my color has an alpha value 0.7, then the object is transparent and i can
see the background. But also i can see through the GLWindow and see objects
from the desktop where the object is.
   
adi
Reply | Threaded
Open this post in threaded view
|

Re: Problem with transparency in GLWindow

adi
In reply to this post by Sven Gothel
Sorry, my error, with
glCaps.setBackgroundOpaque(true)
all is OK
Reply | Threaded
Open this post in threaded view
|

Re: Problem with transparency in GLWindow

gouessej
Administrator
Thanks for the feedback.
Julien Gouesse | Personal blog | Website