1

Now I want 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.

Nikhil
  • 16,194
  • 20
  • 64
  • 81
user610821
  • 71
  • 1
  • 1
  • 4
  • why do you want to have an extra view with you opengl, why not simply draw your image in the background of your opengl View ? – Jason Rogers Feb 10 '11 at 04:47

2 Answers2

0

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.

Community
  • 1
  • 1
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
  • I'm sorry.I did gLSurfaceView.setBackgroundColor(color.transparent); But it didn't work :( – user610821 Feb 10 '11 at 05:05
  • What layout are you using ? I think if your not using and relative layout it won't do the transparency (otherwise I have no ideas sorry) – Jason Rogers Feb 10 '11 at 05:09
  • Now I fixed it using "gLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);" Thank you very much:XD – user610821 Feb 10 '11 at 05:17
0

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);
user610821
  • 71
  • 1
  • 1
  • 4