Results 1 to 2 of 2

Thread: [Android] faces appear semi transparent on one side

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    1

    [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:
    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

    Code :
    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

  2. #2
    Senior Member
    Join Date
    May 2010
    Posts
    207

    Re: [Android] faces appear semi transparent on one side

    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

Similar Threads

  1. how to show semi-transparent object over playing video.
    By aditya.sen in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 1
    Last Post: 11-26-2009, 04:35 PM
  2. semi-transparent texture
    By lawrencesuniga in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 11-08-2005, 08:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •