mobilevisuals
07-08-2011, 12:33 AM
My problem is that the objects get blended together, even if one opaque object is in front of a transparent one. This picture shows how it looks like:
http://www.mobile-visuals.com/transCP.png
The sphere on the picture is behind the morphing object, so they shouldn't be blended together. I don't know why this happens, because I have enabled DEPTH_TEST with
gl.glClearDepthf(1.0f);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glDepthFunc(GL10.GL_LEQUAL);
Does anyone know what I can try to get this to work?
This is the other method calls, which could have an effect on the transparency:
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY );
GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f,39000.0f);
gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0); glSurfaceView.getHolder().setFormat(PixelFormat.RG BA_8888);
http://www.mobile-visuals.com/transCP.png
The sphere on the picture is behind the morphing object, so they shouldn't be blended together. I don't know why this happens, because I have enabled DEPTH_TEST with
gl.glClearDepthf(1.0f);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glDepthFunc(GL10.GL_LEQUAL);
Does anyone know what I can try to get this to work?
This is the other method calls, which could have an effect on the transparency:
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY );
GLU.gluPerspective(gl, 45.0f, (float) width / (float) height, 0.1f,39000.0f);
gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 0, 0); glSurfaceView.getHolder().setFormat(PixelFormat.RG BA_8888);