Darn that black background.

Started by
2 comments, last by masonium 22 years, 6 months ago
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.
Advertisement
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 StripglTexCoord2d(1,1); glVertex3(fX+0.5f,fY+0.5f,fZ); // Top RightglTexCoord2d(0,1); glVertex3f(-0.5f,fY+0.5f,fZ); // Top LeftglTexCoord2d(1,0); glVertex3f(fX+0.5f,fY-0.5f,fZ); // Bottom RightglTexCoord2d(0,0); glVertex3f(fX-0.5f,fY-0.5f,fZ); // Bottom LeftglEnd();glBlendFunc(GL_ONE,GL_ZERO);	// Reset to previous settingsglEnable(GL_DEPTH_TEST);	// (restore)glPopMatrix();			// Restore old position 


Edited by - HellRiZZer on November 2, 2001 3:12:35 AM
Use Photoshop
thanks, hellRiZZer. That''s exactly what I needed.

This topic is closed to new replies.

Advertisement