hi i have a texture and the mask… i can made the thing looks transparent but only when a light hit it… what can i do??? i want that even in the dark it look transparent
this is the portion of code
glEnable(GL_BLEND);
if (lol) dibujaParedes();
glDisable(GL_BLEND);
.
.
.
void dibujaParedes(){
int i,j;
glBlendFunc(GL_DST_COLOR,GL_ZERO);
glBindTexture(GL_TEXTURE_2D, wood[2]);
// Pared Norte
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(i*5.0f, j*5.0f, -500); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f((i+1)*5.0f, j*5.0f, -500); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f((i+1)*5.0f, (j+1)*5.0f, -500) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f( i*5.0f, (j+1)*5.0f, -500); // Bottom Left Of The Texture and Quad
glEnd();
}
}
// Pared Sur
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(i*5.0f, j*5.0f, 500); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f((i+1)*5.0f, j*5.0f, 500); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f((i+1)*5.0f, (j+1)*5.0f, 500) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f( i*5.0f, (j+1)*5.0f, 500); // Bottom Left Of The Texture and Quad
glEnd();
}
}
// Pared oeste
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(-500, j*5.0f, i*5.0f); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f(-500, j*5.0f, (i+1)*5.0f); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f(-500, (j+1)*5.0f, (i+1)*5.0f) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f(-500, (j+1)*5.0f, i*5.0f); // Bottom Left Of The Texture and Quad
glEnd();
}
}
// Pared este
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(500, j*5.0f, i*5.0f); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f(500, j*5.0f, (i+1)*5.0f); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f(500, (j+1)*5.0f, (i+1)*5.0f) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f(500, (j+1)*5.0f, i*5.0f); // Bottom Left Of The Texture and Quad
glEnd();
}
}
glBlendFunc(GL_ONE, GL_ONE);
glBindTexture(GL_TEXTURE_2D, wood[1]);
// Pared Norte
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(i*5.0f, j*5.0f, -500); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f((i+1)*5.0f, j*5.0f, -500); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f((i+1)*5.0f, (j+1)*5.0f, -500) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f( i*5.0f, (j+1)*5.0f, -500); // Bottom Left Of The Texture and Quad
glEnd();
}
}
// Pared Sur
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(i*5.0f, j*5.0f, 500); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f((i+1)*5.0f, j*5.0f, 500); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f((i+1)*5.0f, (j+1)*5.0f, 500) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f( i*5.0f, (j+1)*5.0f, 500); // Bottom Left Of The Texture and Quad
glEnd();
}
}
// Pared oeste
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(-500, j*5.0f, i*5.0f); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f(-500, j*5.0f, (i+1)*5.0f); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f(-500, (j+1)*5.0f, (i+1)*5.0f) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f(-500, (j+1)*5.0f, i*5.0f); // Bottom Left Of The Texture and Quad
glEnd();
}
}
// Pared este
for (i=-100;i<100;i++){
for (j=-40;j<60;j++){
glBegin(GL_QUADS);
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.00f); glVertex3f(500, j*5.0f, i*5.0f); // Bottom Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.00f); glVertex3f(500, j*5.0f, (i+1)*5.0f); // Top Right Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.005f,(40+j)*0.01f+0.01f); glVertex3f(500, (j+1)*5.0f, (i+1)*5.0f) ; // Top Left Of The Texture and Quad
glTexCoord2f((100+i)*0.005f+0.000f,(40+j)*0.01f+0.01f); glVertex3f(500, (j+1)*5.0f, i*5.0f); // Bottom Left Of The Texture and Quad
glEnd();
}
}
}
wood[2] is the mask;
wood[1] is the texture in bmp;
you can download the whole thing from this link
http://rapidshare.com/files/168725523/transp_problem.tar.gz.html
its for linux
thx!!