GLGraphics is a library for the Processing programming language that integrates OpenGL textures and GPU-accelerated effects into the Processing API.
This library offers two main classes, GLTexture and GLTextureFilter, and a new OpenGL renderer that also enables off-screen drawing. GLTexture is a descendant of PImage, so that the use of this class combines seamlessly with the already existing funcionality of PImage. GLTextureFilter is used to load GPU-accelerated image effects or filters, such as blur and edge detection, High Dynamic Range tone mapping, etc., and also more complex GPU effects like the simulation of particle systems.
The goals of the GLGraphics library are the following:
- The integration of OpenGL textures and GPU filters into the Processing API.
- To allow for real time effects on high-definition media.
- To open the possibility of GPGPU (General Processing on GPUs) for visual artists.
A texture filter, encapsulated in the GLTextureFilter class, is basically a GPU shader that operates on an input texture or group of textures and writes the output of the render to another texture(s). The shader can be though as a computational kernel that is executed on the GPU, such as a gaussian blur or emboss effect. On advantage of this approach is that the calculation is actually off-loaded to the GPU, freeing CPU resources for other operations, such as handling user interaction, general flow of the program, etc.
The configuration of a filter is stored in a xml file, where the names of the shaders that define the filter are stored. An entire shader program can consist in a vertex, geometry and fragment shaders, corresponding to each one of the programmable stages of modern GPUs. At this point, the shaders have to written in the OpenGL Shading Language (GLSL or GLslang). Future releases of the library will include support for the Cg shading language from Nvidia.