Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GLSurfaceView with drawable background

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?

like image 833
Jlam Avatar asked Oct 02 '10 00:10

Jlam


2 Answers

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.

like image 130
Romain Guy Avatar answered Sep 18 '22 18:09

Romain Guy


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!

like image 32
jonathan Avatar answered Sep 19 '22 18:09

jonathan