[Android] faces appear semi transparent on one side

Hi all

I have already some experience in open GL ES on Android but I am new to this forum.

I am trying to model a plane on my phone, but I realise that some of the faces of my model appear semi transparent on one side. I have the following setup code:


gl.glViewport(0, 0, width, height);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
gl.glDisable(GL10.GL_CULL_FACE);
gl.glShadeModel(GL10.GL_SMOOTH);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glDepthFunc(GL10.GL_LESS);
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
gl.glEnable(GL10.GL_BLEND);
gl.glEnable(GL10.GL_LINE_SMOOTH);
gl.glEnable(GL10.GL_POINT_SMOOTH);
gl.glEnable(GL10.GL_MULTISAMPLE);
gl.glEnable(GL10.GL_LIGHTING);
gl.glEnable(GL10.GL_LIGHT0);
(light setup ...)
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_SRC_COLOR);
GLU.gluPerspective(gl, 60.0f, (float)width/(float)height, 0.1f, 100.0f);

And before drawing my vertices, I do


gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_AMBIENT_AND_DIFFUSE, _ltsAmbiantAndDiffuses[i]);
gl.glMaterialfv(GL10.GL_FRONT_AND_BACK, GL10.GL_SPECULAR, _ltsSpeculars[i]);
gl.glMaterialf(GL10.GL_FRONT_AND_BACK, GL10.GL_SHININESS, 25.0f);

Even though I have disabled GL_CULL_FACE, I still have the following result:

I can see two shades of white even though all materials have the same colour. One clearly white which is opaque, and one more grey which is semi transparent. When I look at the surface from the top of from the bottom the same face is either grey or white, hence it seems that it is semi transparent only on one side.

Does anyone have an idea about what I could be doing wrong?

Thanks a lot
Nicolas

DO you have appropriate near and far clip planes? It looks like you have a lack of Z culling…but you seem to have enabled the depth buffer…maybe extreme poor precision?

– Steve

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.