How to make the GLSurfaceView transparent

僤鯓⒐⒋嵵緔 提交于 2019-12-20 04:53:38

问题


I am drawing the object on GLSurfaceView using opengles. But GLSurfaceView is not the transparent. Instead of transparent its completely black in background.

Please help me how to make the GLSurfaceView transparent.

I used this code

setEGLConfigChooser(8, 8, 8, 8, 16, 0);
getHolder().setFormat(PixelFormat.TRANSLUCENT);

Thanks in advance.


回答1:


You should add a another property for it:

getHolder().setFormat(PixelFormat.TRANSLUCENT);

// this made it work for me - works only from sdk level 6 on, though....

glview.setZOrderOnTop(true);



回答2:


What i do to get around this is I have regular view such as LinearLayouts within the xml and i call linearLayout.addView(glSurface); linearLayout2.addView(glSurface2);

After that i call them by the order i would like: linearLayout2.bringToFront(); linearLayout.bringToFront();

Let me know if you would like me to post code.



来源:https://stackoverflow.com/questions/17924502/how-to-make-the-glsurfaceview-transparent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!