I need front-to-back compositing functionality and my first intuition was to simply use
(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA)
as blending parameters.
A blank screen leads to the idea, that the color buffer could be only RGB. But
unsigned char bMode; glGetBooleanv(GL_RGBA_MODE, &bMode);
results in ONE, so I decided to have a closer look into the buffer. Then I noticed, that the alpha channel was everywhere ONE, so rendering an object with the above blending function must of course result in (0,0,0,0). So clearing the buffer with (0,0,0,0) before drawing should make a rendered object visible exactly with it’s color and alpha values, doesn’t it?
Finally I observed, that clearing the buffer actually doesn’t clear it
// get (back) buffer
glGetIntegerv(GL_DRAW_BUFFER, &bufferIndex);// and clear it
glClearColor(0.0,0.0,0.0,0.0);
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );// just to be sure…
glFinish();// have a closer look at some region of the buffer
float pMem[10104];
glReadBuffer(bufferIndex);
glReadPixels(100, 100, 10, 10, GL_RGBA, GL_FLOAT, pMem);
Now I’m completely confused…
Who can help me?