# How to make the background of an OpenGL object transparent? [closed]

It sounds so simple but i didn't get it to work.

The Background of my FrameLayout where i add the GLSurfaceView in is colored blue but there is only black.

So here is my method to initiate the Surface...GL..

private void initGL(){

ourSurfaceView = new GLSurfaceView(this);   // GLSurfaceView Objekt erstellen
ourSurfaceView.setEGLConfigChooser(new MultisampleConfigChooser());
ourSurfaceView.setRenderer(new GLRendererTamago());

//In every help i read that it shoud help to use the following two commands... but they did nothing for me.
ourSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
ourSurfaceView.setZOrderOnTop(true);

FrameLayout tama_layout = (FrameLayout)findViewById(R.id.LayoutTama);

}


Someone have any idea?

edit: added the code from my renderer

@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {

gl.glDisable(GL10.GL_DITHER);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
//  gl.glClearDepthf(1f);
//  gl.glClearColor(0,0,0,0);
}

@Override
public void onDrawFrame(GL10 gl) {

gl.glDisable(GL10.GL_DITHER);
gl.glDisable(GL10.GL_DEPTH_TEST);
gl.glMatrixMode(GL10.GL_MODELVIEW);
GLU.gluLookAt(gl, 0, 0, -5, 0, 0, 0, 0, 2, 0);

body.draw(gl);
eyes.draw(gl);
mouth.draw(gl);
}

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {

gl.glViewport(0, 0, width, height);
float ratio = (float)width / height;
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glFrustumf(-ratio, ratio, -1, 1, 1, 20);
}


## closed as off-topic by Josh♦Jun 17 '14 at 15:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh
If this question can be reworded to fit the rules in the help center, please edit the question.

• I'm not the best with OpenGL however have you enabled your blending functions? – Savlon Mar 29 '13 at 20:14
• @Savlon : year, the bleding function was allready enabled. I added my renderer code. – besnep Mar 30 '13 at 12:49
• Will you get the same if you disable some of your mesh renderings? – kolenda Mar 3 '14 at 13:53