Jump to content
  • Advertisement
Sign in to follow this  
EricmBrown

OpenGL Opengl Blending bleeding/artifacting

This topic is 4580 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'm using the following method to draw my mouse, a bitmap textured GL_QUAD. The mouse alpha is a black and white copy used to "fake" the alpha channel (since bitmaps don't support alpha channels). It works great except that I'm getting some artifacting/bleeding of some of the pixels which looks undesireable. Any ideas whats causing it? Thanks.
		glEnable(GL_TEXTURE_2D);
	glEnable(GL_BLEND);
	glDisable(GL_DEPTH_TEST);
	
	glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);
	glBlendFunc(GL_DST_COLOR,GL_ZERO);

	
	setTexture(mouseAlpha);
	glBegin(GL_QUADS);
		glTexCoord2f(0.0,0.0);glVertex2f(loc.x,loc.y);
		glTexCoord2f(1.0,0.0);glVertex2f(loc.x+width,loc.y);
		glTexCoord2f(1.0,1.0);glVertex2f(loc.x+width,loc.y+height);
		glTexCoord2f(0.0,1.0);glVertex2f(loc.x,loc.y+height);
	glEnd();


	glBlendFunc(GL_ONE,GL_ONE);
	setTexture(mouseCurrent);
	glBegin(GL_QUADS);
		glTexCoord2f(0.0,0.0);glVertex2f(loc.x,loc.y);
		glTexCoord2f(1.0,0.0);glVertex2f(loc.x+width,loc.y);
		glTexCoord2f(1.0,1.0);glVertex2f(loc.x+width,loc.y+height);
		glTexCoord2f(0.0,1.0);glVertex2f(loc.x,loc.y+height);
	glEnd();

	glDisable(GL_TEXTURE_2D);
	glEnable(GL_DEPTH_TEST);
	glDisable(GL_BLEND);

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!