This new release of GLGraphics comes hand in hand with GSVideo 0.9, also available today. These new versions of the two libraries introduce a combined mode of operation that greatly improves video playback performance, which I will describe in the next post. Now I will focus on the new features of GLGraphics concerning exclusively with rendering and shading.
My immediate goal for GLGraphics is to have a final 1.0 version to use along with Processing 1.5.x, which should be the latest stable branch of Processing before the jump to 2.0. I have plans for an eventual GLGraphics 2.0 that would take most of the good features of GLGraphics over the new OpenGL engine being developed for Processing 2, and make them more optimized and better integrated with the core API. However, this is subject for future discussions and posts.
Besides the introduction of the “video mode” to use with GSVideo, the changes in GLGraphics 0.99 are minor:
- The setTexUniform() method in the GLSLShader class can now accept either an integer or a GLTexture argument. The former (and older) way of use was a little difficult to understand, since the integer argument must represent the texture unit that is bound to the shader uniform being set. However, exposing a low-level value such as the texture unit is not consistent with the idea of encapsulating the OpenGL functionality with a system of classes. The int version of setTexUniform() can still be used, but now the second alternative is more consistent with the rest of the classes. For instance, if we have a textured GLModel object and we want to apply a GLSLShader to it that uses the texture of the model in its fragment stage, then all we need to do is call shader.setTexUniform(“texSampler”, tex), with tex the GLTexture object used to texture map the model. GLGraphics will automatically determine what is the correct texture unit that needs to be set for the uniform in order to sample from the specified texture object.
- Any GLTextureFilter object now allows to define texture filters with zero input textures, this is, entirely procedural. Also, there is a new type of filter parameter, float arrays, that can be useful to pass lists of float values of arbitrary length to the shader implementing the filter. These features are used in two new examples included with GLGraphics, ShaderLib and ShaderToy, both in the Textures category. These examples port some of the GLSL shaders available in the shader library from Geeks3D, and from the WebGL application Shader Toy by Inigo Quilez.
- The GLGraphicsOffScreen class implements the loadPixels()/updatePixels() methods, which allow to set pixels on the surface manually using the pixels array, and then to copy these pixels to the underlying OpenGL texture.
- Examples were reorganized, with the ones that use other contributed libraries moved to the Integration category.
- A new FishEye texture filter that implements the angular fisheye projection, as described by Paul Bourke.