Originally posted by jmaupay:
[QB]I want to do soft edge-blending (of 2 projected images from 2 graphic cards, lets say Quadro 3000G) with OpenGL on a 3D engine (60Hz).
So I want to do blending and intensity (gamma) correction on the output frame. Do you have any idea of the best way to do it with OpenGL (I need performance, then minimize pixel-fill !)?
This won’t do gamma correction for you, but if a constant attenuation factor (per pixel) is sufficient (as it often can be for overlap blending) then you can accomplish it with a blending pass.
In my experience it is too slow. On faster hardware, and perhaps a tweaked FP, it may be better. (I was using a FX 5700 and barely maintaining 30 fps at 1024x768)
- any extension to access the pixel ?
not sure what you mean.
- any Opengl instruction (stencil) ?
I don’t think the stencil buffer is what you want…
- draw to texture then filter ?
You don’t need to draw to texture, but you could do it that way. If your data is pre-rendered, then drawing and blending could be done in the same pass – maybe not as flexible as drawing first, though.
One way to do it is to draw your scene (however you might do that), and then draw a screen aligned quad textured with your blending texture, using a blending function like this:
gluOrtho2D(0.0, 1.0, 0.0, 1);
… (might want to disable lighting, depth test, etc)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
unitQuad(); // draws a screen-aligned quad with proper texture coords…
Like ZbuffeR has said, applying this only to the pixels that actually need “fixing” will save you fillrate…
In order for this to work there has to be something in the framebuffer already…(in other words, this will not work as the second stage of a multitexture pass, it has to be done as a second pass)
In my experience it is plenty fast.