I am writing an OpenGL-based vector graphics visualizer for my application. It should render the framebuffer object more directly to the screen. Since I am writing an application in Qt, I use the QGLFramebufferObject object, which is the wrapper class for the OpenGL framebuffer object.
I created a minimal example that shows the wrong result, which I also get when rendering more complex things (for example, using a flash shader that sets colors with a non-alpha value). I just draw a red circle and a translucent green on a black cleaned screen, and then the same on FBO:
void MainWidget::initializeGL() { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor(0, 0, 0, 0); } void MainWidget::resizeGL(int w, int h) { glViewport(0, 0, w, h); } void MainWidget::paintGL() {
The result looks like this on the screen (increased by 400%):

Rendering to a QGLFramebufferObject looks like this (also scales by 400%):

Please note that this image is not completely opaque, so here is this image with a closed chessboard:

Even the area in which two circles overlap is not completely opaque. And smoothing looks pretty ugly.
How does this happen? And how can I fix this?
I already tried:
- Various mixing functions.
- Explicitly disabling the depth buffer, stencil buffer, and fetch in the QGLFramebufferObject. I'm not sure if the default format of QGLFramebufferObject adds what I don't want.
source share