1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
gl.glEnable(gl.GL_BLEND); // Enable blnding for transparency
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) ;
//gl.glBlendFunc(gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA) ;
gl.glBegin(GL.GL_TRIANGLES); // display all triangle of the mesh
for(Enumeration e =myTriangleMesh.elements(); e.hasMoreElements(); )
{
t=(Triangle)e.nextElement();
float [][] coordsTmp= t.getCoords();
float [][] normsTmp= t.getNorms();
gl.glColor4f(c2,c3,c1,0.25f);
//sommet 1
gl.glNormal3f(normsTmp[0][0],normsTmp[0][1],normsTmp[0][2]);
gl.glVertex3f(coordsTmp[0][0]-a,coordsTmp[0][1]-b,coordsTmp[0][2]-c);
//sommet 2
gl.glNormal3f(normsTmp[1][0],normsTmp[1][1],normsTmp[1][2]);
gl.glVertex3f(coordsTmp[1][0]-a,coordsTmp[1][1]-b,coordsTmp[1][2]-c);
// sommet 3
gl.glNormal3f(normsTmp[2][0],normsTmp[2][1],normsTmp[2][2]);
gl.glVertex3f(coordsTmp[2][0]-a,coordsTmp[2][1]-b,coordsTmp[2][2]-c);
}
gl.glEnd();
gl.glDisable(gl.GL_BLEND); // fin de la transparence
} |
Partager