Read frame buffer from frag shader?

hi,

i was wondering whether its possible to read pixel values in the frame buffer from a fragment shader without copying them to a texture, perhaps using gl_FragCoord…

i want to adjust brightness and contrast inside a quad.

cheers.

No.

whats the best strategy to do this then?

i’m thinking, render scene, copy relevant section of frame buffer to texture, render quad with colour correction over top of matching area of screen.

is this gonna be efficient? i don’t want to be copying the whole frame buffer into ram every frame.

why not just render to an FBO?

thats probably what i want to do, yeah :stuck_out_tongue:

i can map a section of an fbo into a texture without copying pixels, right?

i’m modifying some existing code that currently renders to a PBO and reads the pixels back b4 sending the data elsewhere.

i’ve added a required option to render to an on screen glx window instead of the PBO, but i want to do colour correction on it, so it sounds like i shld get rid of the PBO and “render to texture” using an FBO, then perform any image processing by rendering that texture to a final destination, be it a window or another buffer.

from http://www.songho.ca/opengl/gl_fbo.html i gather i shld keep a single fbo and attach and detach the buffers as required…

zat sound right?

that sounds more or less OK!

I’m sure you know now, but you don’t need to copy pixels :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.