I am trying to do some image processing on the GPU, e.g. median, blur, brightness, etc. The general idea is to do something like this framework from GPU Gems 1.
I am able to write the GLSL fragment shader for processing the pixels as I’ve been trying out different things in an effect designer app.
I am not sure however how I should do the other part of the task. That is, I’d like to be working on the image in image coords and then outputting the result to a texture. I am aware of the gl_FragCoords variable.
As far as I understand it it goes like that: I need to set up a view (an orthographic one maybe?) and a quad in such a way so that the pixel shader would be applied once to each pixel in the image and so that it would be rendering to a texture or something. But how can I achieve that considering there’s depth that may make things somewhat awkward to me…
I’d be very grateful if anyone could help me with this rather simple task as I am really frustrated with myself.
UPDATE: It seems I’ll have to use an FBO, getting one like this: glBindFramebuffer(…)
It seems like you’ve maybe figured out the FBO thing already.
One thing - you don’t need to worry about whether it’s an orthographic or perspective “view”. You’re writing your own vertex shader - so rip out all of the matrix stuff and have it simply copy the input vertex directly to the output position without change - no matrices are involved and you can draw your quad directly in screen coordinates (-1…1 range). You can turn off depth testing and mask off the depth buffer so you’re not writing to it - this makes things faster too.