Ofxhapplayer getpixels return null


I am using of_v0.9.2_vs_release on windows 10.

while playing a HAP encoded video, using the ofxHapPlayer add on , I try to get the pixels using

player.getPixels() ;

I am consistently getting a null as a return value from the above function.
Any help will be highly appreciated.




the hap player is decoded in the gpu and because of that it doesn’t use pixels i guess


so is there any way I can change the Alpha part of the video being played?
please advise.



using a shader should be the fastest and most flexible but there might be something simpler like using a different blending mode or a global color, depending on what you mean by changing the alpha


I have to overlay the HAP video over a live video feed.

The live feed has a moving object which is identified using absDiff of ofxCvGrayScaleImage with a static image.

Now I want to make the area occupied by the object as transparent in the HAP video. so that the object appears to be a part of the HAP video.

I hope I am making sense…


you can set one texture as a mask for another using ofTexture::setAlphaMask so you can probably do something like:


No luck there,

the image below is the diff, and the one on top is the overlay video,
the live video feed is not visible.

texture = player1.getTexture();


ofxhapplayer seems to be using a shader internally to draw so you probably need to draw the texture instead of the player itself


Am getting an error saying

[ error ] ofTexture: Cannot set alpha mask with different texture target.


you probably need to use GL_TEXTURE_2D as the target for your mask texture, the easiest is to disable rect textures globally with ofDisableArbTex()


How would one go about using GL_TEXTURE_2D as the target for a mask texture, practically speaking?


using setAlphaMask should work the same as long as both textures are GL_TEXTURE_2D


It works, thanks. But it would seem that using an alpha channel on a video as an alpha mask for another video also multiplies the result by the RGB pixel values? Is there a way to disable that?


Hey Arturo,
do you have any example of code, didn’t manage to get it working.
gives me:
Non-const lvalue reference to type ‘ofTexture’ cannot bind to a temporary of type ‘ofTexture *’