Login  Register

JOGL Shader Questions

Posted by bgroenks96 on Mar 25, 2013; 12:55am
URL: https://forum.jogamp.org/JOGL-Shader-Questions-tp4028783.html

This is sort of migrated from JGO.

I'm trying to figure out how to start using GLSL with JOGL to do pixel shading on images drawn to GLAutoDrawable via glDrawPixels.

I'm confused as to how a few things work in GLSL:
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?
2) Do I just assign gl_FragColor to change the pixel?
3) How do I get coordinates of the current pixel?
4) When is glSwapBuffer() necessary?

I've now been told not to use glDrawPixels, which now confuses me even further.

Which adds the new question:
5) What is the most generally reliable method of loading an image and rendering it on a GLDrawable?