GLGraphics 0.99 released   26 comments

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.
For a more detailed list of changes, please refer to the release notes. Check some screenshots from the new examples included in GLGraphics 0.99:

ShaderToy
Procedural ray-tracing filter included in the ShaderToy example.

ShaderLib
Image cross-hatching filter included in the ShaderLib example.

FishEye
Angular fisheye mapping.

26 responses to “GLGraphics 0.99 released

Subscribe to comments with RSS.

  1. since i haven’t said it yet: awesome library!

    BUT:suddenly i’m getting an “NoSuchMethodError: You may be using a library that’s incompatible with this version of Processing.

    Exception in thread “Animation Thread” java.lang.NoSuchMethodError: processing.core.PImage.getCache(Lprocessing/core/PGraphics;)Ljava/lang/Object;
    at processing.opengl.PGraphicsOpenGL.bindTexture(PGraphicsOpenGL.java:821)
    at codeanticode.glgraphics.GLGraphics.renderTriangles(Unknown Source)
    at processing.core.PGraphics3D.endShape(PGraphics3D.java:649)
    at processing.core.PGraphics.endShape(PGraphics.java:1181)
    at processing.core.PGraphics.imageImpl(PGraphics.java:2824)
    at processing.core.PGraphics.textCharModelImpl(PGraphics.java:3703)
    at processing.core.PGraphics.textCharImpl(PGraphics.java:3666)
    at processing.opengl.PGraphicsOpenGL.textCharImpl(PGraphicsOpenGL.java:1598)
    at processing.core.PGraphics.textLineImpl(PGraphics.java:3641)
    at processing.core.PGraphics.textLineAlignImpl(PGraphics.java:3631)
    at processing.core.PGraphics.text(PGraphics.java:3330)
    at processing.core.PGraphics.text(PGraphics.java:3285)
    at processing.core.PApplet.text(PApplet.java:8734)
    at controlP5.Label.renderControlFont(Unknown Source)
    at controlP5.Label.draw(Unknown Source)
    at controlP5.Textlabel.draw(Unknown Source)
    at controlP5.ControllerGroup.drawControllers(Unknown Source)
    at controlP5.ControllerGroup.draw(Unknown Source)
    at controlP5.ControlWindow.draw(Unknown Source)
    at controlP5.ControlP5.draw(Unknown Source)
    at objLoaderFX_pro_glow.draw(objLoaderFX_pro_glow.java:200)
    at processing.core.PApplet.handleDraw(PApplet.java:1606)
    at processing.core.PApplet.run(PApplet.java:1503)
    at java.lang.Thread.run(Thread.java:680)”

    and all this in a sketch which was running fine a few days ago!?

    It’s somehow caused by the Processing-own ‘text();’ function. Even in your BloomFilter-example.
    The only thing i can think of which has changed, is that I have updated Processing to 1.5.1. But i have the same Sketch with 1.5.1 running fine on another Computer…

    any ideas?

    • This sounds strange… I’m not aware of any incompatibility between the text() method and GLGraphics in Processing 1.5.1

      Could you post a simple sketch somewhere that reproduces the error, so I can look at it? Thanks!

  2. Hey great update to the library. Just letting you know that every time I try and run either the saderToy or shaderLib examples I get the following error.

    ShaderToy quit unexpectedly while using the libjogl.jnilib plug-in.
    Invalid memory access of location 0x65791000 eip=0xffff0837

  3. Yep running OSX 10.6.8 and Processing 01.95
    Would really love to have the shader Toy examples running in Processing.

    Thanks

  4. just downloaded and tried with 1.5.1 and getting the same error as before…..

    • I’m using OSX 10.6.8 with Processing 1.5.1, and the ShaderToy example works fine.

      Do you get the crash inside the PDE, or when running the sketch as an applet or exported app? Also, does it happen immediate after you start the sketch, or after some time?

  5. I’m getting the same crash when running inside the PDE and as an Exported Applet.

    it opens for about 1 sec and then crashes and prints this in the PDE > Invalid memory access of location 0×65791000 eip=0xffff0837

    If you give me your email I can email you the full crash log.

  6. Hey mate now when I try and run the shaderToy patch it just hangs and crashes my computer…..hmm very weird.

  7. AMD Radeon HD 6750M in a new 17inch MacBook Pro.

  8. ok, I see. I have tested the shadertoy example only on geforces so far. I should be getting a new MBP with Radeon graphics soon, so I will be able to debug this issue.

  9. Ok cheers man. Ill keep checking back. Thanks for the tech support.

  10. Hey mate, I ended up re-building the example with another shadertoy example from scratch and it works. That’s all I need it for anyway. Must have been one of the shaders that my lappy wasn’t agreeing with….?

    Anyway THANKS SO MUCH for this amazing library. So good to see processing now able to host such amazing graphics. cheers.

  11. P5 1.5.1 – GSVideo 0.9 – GLGraphics 0.99

    I’m trying to run the GL examples included in the GSVideo package (Capture, HDmovie, Pipeline), and I have an ugly stuttering. I mean, playing a movie or capturing from webcam framerate is ok, but seems like a bad inverse telecine. Visually seems ike shooting the previous frame. Ej: frames 1,2,1,3,2,4,3,5,4…and so on.
    Any recomendation?

  12. Well, I’ve missed the updates!
    Sadly, I’m having the same issue with version 1.0 of both libraries.
    Do you have any idea about that? Maybe some bad config on the nvidia settings?

    i7 – Quadro FX 880M – win7 64
    P5 1.5.1 – GSV 1.0 – GLG 1.0

    • Not sure really… Using setPixelBufferSize() and delPixelsWhenBufferFull() might have an effect:


      tex = new GLTexture(this);
      movie.setPixelDest(tex);

      // Sets a frame buffer of size 5 and configures GLGraphics
      // to drop frames when the buffer reaches its max capacity
      tex.setPixelBufferSize(5);
      tex.delPixelsWhenBufferFull(true);
      movie.loop();

  13. Oh… I’ve allready tried that. If I set delPixelsWhenBufferFull(true); then looks like drop frames.
    But no matters how much frames I set in the buffer, the applet count 0 buffered frames.
    Luckilly I´ve found if I slowdown the framerate the flickering is reduced. But at 12fps, so…
    Any Idea?
    Second one: I’ve tried to capture the sttutering and write it to a file (to show you), with the MovieMaker example code. As default, write an Theora video that I can´t play (I used to play fine ogg videos). So I’ve tried to change the codec, but gives me a message saying I need some GStreamer encoder plugins. Need I install the GStreamer bins?
    Last one: Why the Movie example plays audio? Is that right?

  14. Hello. For the stuttering/flickering problem, I’d recommend re-encoding your video with a codec that goes along with gstreamer more nicely. For example, I was just doing some tests using an mp4 video encoded with h264, and it would consistently drop frames. I re-encoded it as an avi file with the xvid codec and the playback improved significantly.

    About the audio: if the video has an audio track that is encoded with a codec that gstreamer understands, then it will try to play the audio back. If you don’t want the audio to be heard, you can just call setVolume(0), or remove the audio track from your video file.

  15. Hi Andrés! Love the library, I’ve used it in a bunch of projects and it’s a real time saver. I was wondering what the current plans were for processing 2.0 integration. Will there be similar features built into the processing core or are there any plans to update this library int he future?

Leave a comment