Re: JOGL Shader Questions
Posted by Demoscene Passivist on Mar 25, 2013; 7:04am
URL: https://forum.jogamp.org/JOGL-Shader-Questions-tp4028783p4028787.html
>1) How can I access the color of the current pixel in the shader call?
>What is the form of that pixel (RGB, BGR, etc.) so that I can unpack it?
You simply can't. That's the whole idea with shaders that they run in parallel. But you can access the pixels from a previous frame with some additional work.
>2) Do I just assign gl_FragColor to change the pixel?
Exactly!
>3) How do I get coordinates of the current pixel?
I guess you mean screen coordinates: gl_FragCoord.xy
>4) When is glSwapBuffer() necessary?
Generally when you are finished rendering your frame.