ofxHapPlayer icon indicating copy to clipboard operation
ofxHapPlayer copied to clipboard

Hap Video opacity become gray in color

Open arnoldyuhin opened this issue 9 years ago • 2 comments

I am developing on OSX El Capitan and OF0.8.4. Trying to play videos with hap alpha codec one over other, I found that the one with opacity on top will become gray in color. The gray color mainly appears on the pixels of opacity within 0 to 255, which is completely ok on 0 or 255 in alpha channel. I can see that the gray part is transparent to show the bottom layer, but what I want is to blend it lighter in color than make it gray. Anyone have idea how to adjust the code so that I can make it? Thanks!

arnoldyuhin avatar Feb 26 '16 04:02 arnoldyuhin

I have solved it. The problem is caused by the rendering order of the OpenGL. I am not sure about the details but adding the following code before the draw() function will make it work.

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);

If you want to know more about this, you may take a look here: http://stackoverflow.com/questions/17224879/opengl-alpha-blending-issue-blending-ignored-maybe

arnoldyuhin avatar Feb 26 '16 06:02 arnoldyuhin

Thanks for the report. We should probably set the blend function in draw() when the movie has alpha, so I'll reopen this until that is done.

bangnoise avatar Feb 26 '16 10:02 bangnoise