🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lesson 8 question

Started by
1 comment, last by Bart Simpson 24 years ago
On a cube, how can I make semi-trasparent only one face?
Advertisement
Instead of enabling blending for all the faces of your cube just enable blending for the one face that you want blended. For example:

Draw Face 1
Draw Face 2
Draw Face 3
Draw face 4
Draw face 5

glEnable(GL_BLEND);
glBlendFunc(whatever you use);
Draw Face 6
glDisable(GL_BLEND);

This code should work, haven''t tried it out or anything. I don''t play with blending much. Hope this helps!

I do...

if (materialList[curMat]->alpha < 1.0)
{
glEnable(GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1.0f,1.0f,1.0f,materialList[curMat]->alpha);
}
else
{
glColor3f(1.0f,1.0f,1.0f);
}

...draw face....

if (materialList[curMat]->alpha < 1.0)
{
glDisable(GL_BLEND);
}

Hope this helps,
Spikus

This topic is closed to new replies.

Advertisement