Hello, I'm running this raymarching effect from shadertoy:
https://www.shadertoy.com/view/MdX3Rr, in a Java program where the rendering takes place inside a GLCanvas (which I set as the parent of the Display object), and the rendering is very choppy.
My test system is a macbook pro with OSX 10.8.3 and a Radeon HD 6490M video card. On shadertoy, the effect runs slow (~14fps, as it is very fragment-shader intensive), but the rendering is reasonably smooth. In a simple LWJGL program without canvas (just a barebones loop adapted from the basic LWJGL examples), the rendering is also smooth.
But when I run this effect in a more complex Java program where I use a GLCanvas as the parent for the LWJGL display (same machine, LWJGL 2.9.0), the rendering stutters significantly. One strange thing is that the fps, as calculated from the Java application, is similar to the fps reported by shadertoy.
It seems to me that there is some threading issue going on, but not sure how to debug it. The GLCanvas is attached to an Applet object, which in turn is inside an AWT Frame. Maybe this structure is conflicting with LWJGL's rendering mechanism? I run the program both with Java 6 and 7, and the stuttering doesn't change.
Just in case anyone wants to take a look, the code for the simple LWJGL program (no GLCanvas) is here:
https://github.com/codeanticode/lwjgl-tests/blob/master/src/test/simple/ShaderTest.javawhile the program that uses GLCanvas is the following:
https://github.com/codeanticode/lwjgl-tests/blob/master/src/test/applet/DispApplet.javaAny help and/or comments will be highly appreciated.
Andres