Archived

This topic is now archived and is closed to further replies.

Darn that black background.

This topic is 5886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a type of texture that is very popular with particle engines (TGA). It has the white center and the black background. I am texture-mapping this texture onto a quad. How do I get the black background to not show up? In other words, how do I use transparency to get rid of the black? I think you use blending or something, but I''m not sure how.

Share this post


Link to post
Share on other sites
quote:
Original post by masonium
I have a type of texture that is very popular with particle engines (TGA). It has the white center and the black background. I am texture-mapping this texture onto a quad. How do I get the black background to not show up? In other words, how do I use transparency to get rid of the black? I think you use blending or something, but I'm not sure how.



Not sure what you mean by not showing black background, but thats what I do to draw textured particle quad:


glPushMatrix(); // Save Current position

glDisable(GL_DEPTH_TEST); // Disable Depth Testing
glEnable(GL_BLEND); // Enable Blending
glBlendFunc(GL_SRC_ALPHA,GL_ONE); // Type Of Blending To Perform
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); // Really Nice Perspective Calculations
glHint(GL_POINT_SMOOTH_HINT,GL_NICEST); // Really Nice Point Smoothing

glBindTexture(GL_TEXTURE_2D,m_material.ID);
glColor4f(fRed ,fGreen ,fBlue , fLife );

glBegin(GL_TRIANGLE_STRIP); // Build Quad From A Triangle Strip
glTexCoord2d(1,1); glVertex3(fX+0.5f,fY+0.5f,fZ); // Top Right
glTexCoord2d(0,1); glVertex3f(-0.5f,fY+0.5f,fZ); // Top Left
glTexCoord2d(1,0); glVertex3f(fX+0.5f,fY-0.5f,fZ); // Bottom Right
glTexCoord2d(0,0); glVertex3f(fX-0.5f,fY-0.5f,fZ); // Bottom Left
glEnd();

glBlendFunc(GL_ONE,GL_ZERO); // Reset to previous settings
glEnable(GL_DEPTH_TEST); // (restore)
glPopMatrix(); // Restore old position



Edited by - HellRiZZer on November 2, 2001 3:12:35 AM

Share this post


Link to post
Share on other sites