PDA

View Full Version : How to get a color of a previous pixel in a fragment shader?



Xroft
11-08-2004, 09:36 PM
I'm using ARB_vertex_program and I need to get a color of a pixel which was previously on the place where a new pixel would be set. Can I somehow get a color of a previous pixel in a fragment program (for example, to make blending or something like this)?

I can use standard OpenGL functions to make blending, but these functions do not exactly apply to my task. The other way is to get a pixel color from a color buffer and to pass it to a fragment program as a parameter, but it is too slow.

If I can get a color of a previous pixel in some other ways, please, tell me how.

Thanks,
Xroft.

Lurker_pas
11-08-2004, 10:10 PM
I don't know what you are realy trying to do, but in some cases when you can divide the scene into few layers, you can do with binding the current background to a texture(for example by rendering it to a pbuffer). Works for me when I try to get the average of red and green.
The other way is to sit and wait till next spec of glslang and hope for resurrection of gl_FB*...
See you!

Xroft
11-09-2004, 01:39 AM
Thank you!
Your suggestion can be useful for me!