Special Effects

Jeff Binder
Unregistered
 
Post: #16
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #17
Aha! Now it works! Thanks Jeff.
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #18
How would I do that and still keep my mask working? My code is this:
glLoadIdentity();
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glBlendFunc(GL_DST_COLOR,GL_ZERO);

glTranslatef(pos_x,pos_y,pos_z);

glRotatef(rotate, 0.0, 1.0, 0.0);

glEnable(GL_TEXTURE_2D);

glBindTexture(GL_TEXTURE_2D, mask.texID);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3d( 0.0f, 0.0f, 0.1f);

glTexCoord2f(1.0f, 0.0f); glVertex3d( squareSize, 0.0f, 0.1f);

glTexCoord2f(1.0f, -1.0f); glVertex3d(squareSize, -squareSize, 0.1f);

glTexCoord2f(0.0f, -1.0f); glVertex3d(0.0f, -squareSize, 0.1f);
glEnd();
glDisable(GL_TEXTURE_2D);

glEnable(GL_TEXTURE_2D);
glBlendFunc(GL_ONE, GL_ONE);
glBindTexture(GL_TEXTURE_2D, texture.texID);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3d( 0.0f, 0.0f, 0.1f);

glTexCoord2f(1.0f, 0.0f); glVertex3d( squareSize, 0.0f, 0.1f);

glTexCoord2f(1.0f, -1.0f); glVertex3d(squareSize, -squareSize, 0.1f);

glTexCoord2f(0.0f, -1.0f); glVertex3d(0.0f, -squareSize, 0.1f);
glEnd();
glDisable(GL_TEXTURE_2D);

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1.0, 1.0, 1.0, 0.7);

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3d( 0.0f, 0.0f, 0.1f);

glTexCoord2f(1.0f, 0.0f); glVertex3d( squareSize, 0.0f, 0.1f);

glTexCoord2f(1.0f, -1.0f); glVertex3d(squareSize, -squareSize, 0.1f);

glTexCoord2f(0.0f, -1.0f); glVertex3d(0.0f, -squareSize, 0.1f);
glEnd();

glEnable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #19
Doing a mask in one pass would be a lot better.
Quote this message in a reply
Moderator
Posts: 608
Joined: 2002.04
Post: #20
Quote:Originally posted by David
Doing a mask in one pass would be a lot better.
And I would do that how...? Sorry for the newbie questions Sad
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #21
Try loading a file with an alpha mask into a texture with GL_RGBA and then display this texture with blending on and glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Pixel Art: a special program required?!?! Max 4 4,834 May 1, 2005 02:06 PM
Last Post: Max