3
\$\begingroup\$

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);
    tama_layout.addView(ourSurfaceView, 0);     

}

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);
    gl.glLoadIdentity();
    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.glLoadIdentity();
    gl.glFrustumf(-ratio, ratio, -1, 1, 1, 20);
}
\$\endgroup\$
  • \$\begingroup\$ I'm not the best with OpenGL however have you enabled your blending functions? \$\endgroup\$ – Savlon Mar 29 '13 at 20:14
  • \$\begingroup\$ @Savlon : year, the bleding function was allready enabled. I added my renderer code. \$\endgroup\$ – besnep Mar 30 '13 at 12:49
  • \$\begingroup\$ Will you get the same if you disable some of your mesh renderings? \$\endgroup\$ – kolenda Mar 3 '14 at 13:53