I would like to use shaders (both vertex and fragment) for hw-accalerated sub-ipxel intialiasing of text.
I have a glyph-texture (a texture with just a single rendered letter in it) which I need to “blit” to a surface (PBuffer, Screen, FBO). The resulting pixel color depends on the color of the pixel I am overwriting on screen - however I do not have an idea how I could get access to the screen’s pixels.
What I would like to do:
1.) get position of actual rendering (done in vertex shader with shared variable) - ok
2.) get pixel-value of the glyph-texture for current pixel - ok
3.) get pixel-value of the surface where the texture should be painted to for current pixel - ???
4.) Compute pixel value
The only idea I had was to render into a pbuffer first, bind it to a texture (so I can access it from the shader), create a second (to just render the glyph + shader in it) and last render the second pbuffer into the first.
However thats not only complicated but also quite slow
Any better ideas?
Thank you in advance, lg Clemens