Advertisement

transperancy

Started by January 20, 2002 04:20 PM
1 comment, last by phantom007 23 years, 1 month ago
The following code is how I place a player onto the field, what if I wish to make them transperant of 50%? I have tried glColor4f(1.0f, 1.0f, 1.0f, 0.5f); but it isn't that simple. class player_graphics { glLoadIdentity(); glTranslatef(x, y, z); glColor3f(1.0f, 1.0f, 1.0f); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(-bl, 0.0f, 0.15f); glTexCoord2f(1.0f, 0.0f); glVertex3f(bl, 0.0f, 0.15f); glTexCoord2f(1.0f, 1.0f); glVertex3f(bl, (bh*2), 0.15f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-bl, (bh*2), 0.15f); glEnd(); } Edited by - phantom007 on January 20, 2002 5:22:50 PM
www.koalacomics.com.au for a humour comic
www.lobag.com for my fantasy RPG PBBG
www.testcricketmanager.com for my sports management game
you have to enable blending first I think:

In your initialization code, throw in these two lines:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Now when you do glColor4f(x, y, z, a) . . . the ''a'' will affect the color.

"PC Load Letter, what the F*Ck's that" ~Office Space
Advertisement
Works absaloutely perfect now. Thanks for your help
www.koalacomics.com.au for a humour comic
www.lobag.com for my fantasy RPG PBBG
www.testcricketmanager.com for my sports management game

This topic is closed to new replies.

Advertisement