Mickey008
11-24-2003, 01:05 AM
A question about transparency ,deep test,color and light.
Please check the following codes.My question is that when I add the line marked with (*),the cone will not be disguised by other objects;while when I remove the line,the cone will have some problems on color and light,the cone will not be smooth,and there is a cover in the middle of the cone.How can I both get the disguised effect and the smooth surface and proper color and light£¿
Thanks a lot!
pfPushState();
pfPushMatrix();
pfBasicState();
glPushMatrix();
GLint matmode;
GLfloat projmat[16];
static int flag = 0;
static GLfloat ambient[4] = { 1.0, 1.0, 1.0, 0.0 };
pfCullFace(PFCF_OFF);
pfTransparency( PFTR_FAST );
glEnable(GL_DEPTH_TEST);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
glDisable( GL_DEPTH_TEST ); //£¨*£©
glGetIntegerv( GL_MATRIX_MODE, &matmode );
glMatrixMode( GL_PROJECTION );
glGetFloatv( GL_PROJECTION_MATRIX, projmat );
glMatrixMode( matmode );
......here we draw a cone£¨code omitted£©
glPopMatrix();
pfPopMatrix();
pfPopState();
Please check the following codes.My question is that when I add the line marked with (*),the cone will not be disguised by other objects;while when I remove the line,the cone will have some problems on color and light,the cone will not be smooth,and there is a cover in the middle of the cone.How can I both get the disguised effect and the smooth surface and proper color and light£¿
Thanks a lot!
pfPushState();
pfPushMatrix();
pfBasicState();
glPushMatrix();
GLint matmode;
GLfloat projmat[16];
static int flag = 0;
static GLfloat ambient[4] = { 1.0, 1.0, 1.0, 0.0 };
pfCullFace(PFCF_OFF);
pfTransparency( PFTR_FAST );
glEnable(GL_DEPTH_TEST);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);
glDisable( GL_DEPTH_TEST ); //£¨*£©
glGetIntegerv( GL_MATRIX_MODE, &matmode );
glMatrixMode( GL_PROJECTION );
glGetFloatv( GL_PROJECTION_MATRIX, projmat );
glMatrixMode( matmode );
......here we draw a cone£¨code omitted£©
glPopMatrix();
pfPopMatrix();
pfPopState();