Hi and welcome to part 3 of my series: I can’t get OpenGL up and running on Linux.
As we’ve seen in part two, MSAA isn’t supported on Linux. So now I’m trying to fake anti aliasing with several transparent layers. I’m trying to set up transparency / blending as follows:
OpenGLComponent::OpenGLComponent() {
setOpaque(true);
m_openGL.setRenderer(this);
m_openGL.setContinuousRepainting(true);
m_openGL.attachTo(*this);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
I then pass colors via a uniform into my fragment shader. When rendering blue stuff with different alpha values on black / white, this is the result:
Fully opaque: so far, so good…
Half transparent: The blue section overlying the black background should not be fully blue.
Full transparent: There should be no blue in this image whatsoever.
I have noticed that changind the two lines
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
to different values, or even removing them completely makes no difference, so my guess is that some default blending mechanism is being used. Or perhaps the blending feature is missing as well on linux? (I don’t have access to a windows machine ATM to compare).