Set Cocos2dxGLSurfaceView background transparent

Hi,

I’m making a view composed of Android UI + Cocos2dxGLSurfaceView. I’ve used the Handler for reach UI Thread from cocos2d.

For now, every seems to work right, but the problem is that I need to set the background of the main Cocos2dxGLSurfaceView to transparent, so the user can see the UI View at the bottom of the screen.

I’ve tried this:

mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.helloworld_gl_surfaceview);
mGLView.getBackground().setAlpha(0);

But the drawable background returned is null.

Also I’ve tried:

mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.helloworld_gl_surfaceview);
mGLView.getHolder().setFormat(PixelFormat.TRANSPARENT);

This works OK but makes all the OpenGL Layer transparent.

Please, anyone could tell me any approach for this?

Thanks in advance

2 Likes

I have same problem. So who can help this ??

Refer this link : CCEGLView background transparent

1 Like