相关疑难解决方法(0)

Android OpenGL ES透明背景

我正在构建一个利用OpenGL的Android应用程序.就目前而言,它的背景GLSurfaceView是由我的代码动态生成的,并作为纹理加载并绘制glDrawTexfOES.这是"OK",但我可以简单地更加流畅显示图像自身的表面(无OpenGL的).有什么方法可以让GLSurfaceView透明的背景?我听说过一些传言说这可以做到setEGLConfigChooser,但我还没有找到任何确认.最后,我想带一个面我画并把GLSurfaceView在它达到一个层次分明的效果.

我知道这是一个棘手的,很可能是不可行的,但任何输入都是值得赞赏的.提前致谢.

android background opengl-es transparent

25
推荐指数
4
解决办法
2万
查看次数

Android,透明子GLSurfaceView布局?

可能重复:
Android OpenGL ES透明背景

我想在普通的2d ui布局屏幕上显示一些3d对象.

2d ui屏幕具有背景图像,GLSurfaceView是内容布局的子项.

我在ApiDemos样本中尝试了相同的Translucent GLSurfaceView技术,

但GLSurfaceView清除所有并显示黑色背景.


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"    
    android:background="@drawable/my_background_image"
>

...

<android.opengl.GLSurfaceView android:id="@+id/glview"  
    android:layout_width="fill_parent"
    android:layout_height="300px"
    android:windowIsTranslucent="true" (i'm not sure this is right)
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
setContentView(R.layout.main);
...
glview = (GLSurfaceView) findViewById(R.id.glview);
glview.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
glview.getHolder().setFormat(PixelFormat.TRANSLUCENT);
glview.setRenderer(this);
...
gl.glClearColor(0, 0, 0, 0);
...
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我可以保留底层背景图像吗?

android background opengl-es transparent

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×2

background ×2

opengl-es ×2

transparent ×2