Problems with transparency in PNGs

Hi all,
I’m having trouble displaying my .png image with transparency correctly.

It works when I drop it in the OF graphicsExample program. However, in my program the image renders with the transparent portions replaced with the current ofSetColor().

Also, in my code below, it renders ofSetColor(255) as blue. If I change it to (255,255,255) it renders as white.

This image is being drawn amongst other lines, shapes, and a Quicktime animation. I have tried removing these but it doesn’t seem to influence the .png rendering problem.

thanks!
Charlie

  
void testApp::drawImage() {  
	ofSetColor(255);  
	ofEnableAlphaBlending();  
	rectMask.draw(0, 113); // this is the .PNG image that doesn't draw correctly  
	ofSetColor(255);  
	jaggedLines.draw(0, 563);  
	ofDisableAlphaBlending();  
	  
}  

are you drawing into a FBO by any chance? if so make sure you initialize it to GL_RGBA as some implementations act funny with just GL_RGB FBOs and transparency.

Other than that, make sure your blend mode is also set properly with ofEnableBlendMode(OF_BLENDMODE_ALPHA).

Thanks for the help Tim! I didn’t know about the ofEnableBlendMode stuff.

I discovered one of my coworkers had modified the OF build – so somehow that caused this problem.

thanks!
Charlie