Skip to content

Commit 6a7c30b

Browse files
committed
Merge pull request cats-oss#208 from jonan/transparent
Transparent GLSurfaceView background
2 parents 8ca48f1 + 28f785a commit 6a7c30b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

library/src/jp/co/cyberagent/android/gpuimage/GPUImageRenderer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ public GPUImageRenderer(final GPUImageFilter filter) {
9191

9292
@Override
9393
public void onSurfaceCreated(final GL10 unused, final EGLConfig config) {
94-
GLES20.glClearColor(0, 0, 0, 1);
95-
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
94+
GLES20.glDisable(GL10.GL_DITHER);
95+
GLES20.glClearColor(0,0,0,0);
96+
GLES20.glEnable(GL10.GL_CULL_FACE);
97+
GLES20.glEnable(GL10.GL_DEPTH_TEST);
9698
mFilter.init();
9799
}
98100

library/src/jp/co/cyberagent/android/gpuimage/GPUImageView.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import android.graphics.Bitmap;
2121
import android.graphics.Color;
2222
import android.media.MediaScannerConnection;
23+
import android.graphics.PixelFormat;
2324
import android.net.Uri;
2425
import android.opengl.GLES20;
2526
import android.opengl.GLSurfaceView;
@@ -56,6 +57,9 @@ public GPUImageView(Context context, AttributeSet attrs) {
5657

5758
private void init(Context context, AttributeSet attrs) {
5859
mGLSurfaceView = new GPUImageGLSurfaceView(context, attrs);
60+
mGLSurfaceView.setZOrderOnTop(true);
61+
mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
62+
mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
5963
addView(mGLSurfaceView);
6064
mGPUImage = new GPUImage(getContext());
6165
mGPUImage.setGLSurfaceView(mGLSurfaceView);

0 commit comments

Comments
 (0)