views:

119

answers:

2

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?

A: 

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.)

Miguel Morales
Tired it but it wasn't working because of the following conditions: 1. The gl layer has a constant background image. 2. there are additional elements on top of the gl layer such as buttons etc. It wasn't possible to set the static image as a background on the gl layer because the actual 3d content would not render unless I setZOrderOnTop(true) on the gl layer. But if I do that then the additional elements would end up under the gl layer.
Jlam
+1  A: 

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.

Romain Guy
Thank you that was very helpful! Is there a way that you could recommend for achieving what I needed: static background image -> 3d content -> additional views buttons on top or is the only way to just render the static background as texture on a polygon?
Jlam
I ended up just rendering the background on a polygon behind everything else.. thanks for the tip!
Jlam