Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - grassick

#1
Support / Re: Odd transparent Overlay behavior
October 10, 2013, 10:20:01 PM
Aha!

http://stackoverflow.com/questions/2361602/transparent-texture-in-opengl-es-for-android gave me a suggestion.

I added:

   public void onSurfaceCreated(GL10 gl, EGLConfig config) {
      // Enable blending using alpha
       gl.glEnable(GL10.GL_BLEND);
       gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
   }


Seems to solve it perfectly.
#2
Support / Odd transparent Overlay behavior
October 10, 2013, 08:29:24 PM
I have an Overlay which I want to be mostly transparent (it is of a non-rectangular shape). I create a Texture (Texture tex = new Texture(myimage, true);) and then display the Overlay.

The GLSurfaceView is translucent, so I'd expect to see my Overlay on top of all objects but only opaque in non-transparent parts.

What happens is that it is indeed transparent in the right places but still obscures 3d objects behind it. That is, it keeps the GLSurfaceView transparent in the right places, but doesn't allow 3d objects to show though the transparent parts!

Since this is for an augmented reality app, the effect is that the overlay displays the camera preview perfectly underneath but obscures 3d objects for the overlay's entire bounds.

I should add that I'm using alpha transparency in the image and that it appears to me that Overlay is blitting the entire texture up, including alpha, rather than blending it according to the alpha. That would explain the behavior I see.

What on earth am I doing wrong?

Thanks,

Clayton