ofxPiMapper icon indicating copy to clipboard operation
ofxPiMapper copied to clipboard

Outlines on png alpha image?

Open haelbichalex opened this issue 7 years ago • 13 comments

Hi! So I am using a custom FBO source to render a background image and a PNG on top. Without ofxPiMapper everything looks fine, but now I have these weird outlines around my png. I tried using ofEnableAlphaBlending() in both custom source and ofApp.cpp without success. I also tried getting multisample antialiasing to work by using fbo->allocate(width, height, GL_RGBA, 4) in FboSource.cpp but then I only get a black screen. Any hints?

unbenannt

haelbichalex avatar Oct 30 '17 14:10 haelbichalex

Hi! How big is the image and can you send me the file?

kr15h avatar Oct 30 '17 14:10 kr15h

It's 70KB small. It's a cutout of the background so it should blend perfectly in. ebene1_00000

haelbichalex avatar Oct 30 '17 14:10 haelbichalex

I see. Can I have also the background?

kr15h avatar Oct 30 '17 15:10 kr15h

I just linked it in my previous answer 👍

haelbichalex avatar Oct 30 '17 15:10 haelbichalex

got it. will take a look.

kr15h avatar Oct 30 '17 16:10 kr15h

Which platform are you using? As on Mac it fits perfectly.

kr15h avatar Oct 30 '17 16:10 kr15h

My destination platform is Windows 10 using Visual Studio 2015. I just tried it on my Mac as well, but I get those outlines there as well 😕 My custom source just looks like this, with '2.png' being the background:

#include "CustomSource.h"

void CustomSource::setup(){
	name = "Custom FBO Source";
	allocate(1920, 1080);

    img1.load("1.png");
    img2.load("2.png");
}

// Don't do any drawing here
void CustomSource::update(){
}

void CustomSource::draw(){
    img2.draw(0,0,1920,1080);
    img1.draw(0,0,1920,1080);
}

haelbichalex avatar Oct 30 '17 16:10 haelbichalex

Ah you using custom source. Good. Now I have more hints.

kr15h avatar Oct 30 '17 19:10 kr15h

This was due the ofFbo using different ways of blending. I fixed that by adding the following to the SurfaceStack in ofxPiMapper code.

glEnable(GL_BLEND);
glBlendFuncSeparate(GL_ONE, GL_ZERO, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

Check commit for more details.

kr15h avatar Oct 31 '17 10:10 kr15h

So this did work on my Mac. Unfortunately on Windows the problem still exists.

haelbichalex avatar Oct 31 '17 10:10 haelbichalex

OK. Let's see...

kr15h avatar Oct 31 '17 10:10 kr15h

So does OF on Windows use another method for blending the fbo? I tried updating to the latest version of glew.

haelbichalex avatar Nov 02 '17 13:11 haelbichalex

I'm working on my windows virtualbox. unfortunatelly the internet where I am now is very slow and I am packed with deadlines. Soon...

kr15h avatar Nov 03 '17 17:11 kr15h