开发者

How to stop OpenGL ES drawing background color on Android?

开发者 https://www.devze.com 2023-02-09 09:58 出处:网络
Now I wan开发者_如何学运维t to insert a ImageView behind the GLSurfaceView.But the GLSurfaceView always draws background color so I can\'t see the ImageView.I tried glClearColor(0,0,0,0) but it doesn\

Now I wan开发者_如何学运维t to insert a ImageView behind the GLSurfaceView.But the GLSurfaceView always draws background color so I can't see the ImageView.I tried glClearColor(0,0,0,0) but it doesn't work.What should I do?Please help me! Thank you very much.


If I remember correctly you should be able to adapt this

Overlapping Views in Android

to your needs

(relative layout and android:background="#0000")

since GLSurfaceView is a View it should work.


I fixed it. using

    gLSurfaceView.setEGLConfigChooser(8,8,8,8,16,0);
    gLSurfaceView.setRenderer(this);
    RelativeLayout rl = new RelativeLayout(this);
    BgLayout bgl = new BgLayout(this);
    gLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
    gLSurfaceView.setZOrderOnTop(true);
    rl.addView(bgl);
    rl.addView(gLSurfaceView);
0

精彩评论

暂无评论...
验证码 换一张
取 消