Android GLSurfaceView with drawable background

谁说我不能喝 提交于 2019-12-06 02:58:35

问题


I have a GLSurfaceView with a drawable as background, however only the background is visible when rendered without surfaceView.setZOrderOnTop(true)

I need to avoid using setZOrderOnTop(true) because there are static TextView's being used on top of the GLSurfaceView.

Any suggestions for getting this to work?


回答1:


GLSurfaceView cannot really have a background. The way a surface view works is by cutting a hole through your Activity's window and showing another surface behind. Setting setZOrderOnTop(true) moves the surface above the Activity's window.




回答2:


false! You can do it. Just an example to show how it works.

glRenderer  = new OpenGLRenderer(context);
view = new GLSurfaceView(context);
view.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
view.setRenderer(glRenderer);
view.getHolder().setFormat(PixelFormat.RGBA_8888);
view.getHolder().setFormat(PixelFormat.TRANSLUCENT);
view.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);

Then use framelayout to put a view under glsurfaceview!




回答3:


Try setZOrderMediaOverlay(true); which should put the gl layer above the background but below the window.




回答4:


Well, since GLSurfaceView is just another view, why not use a FrameLayout to place the GLSurfaceView on top of the ImageView (or whatever you're using to display the drawable.)



来源:https://stackoverflow.com/questions/3843853/android-glsurfaceview-with-drawable-background

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