aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java251
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java160
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp217
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp52
4 files changed, 373 insertions, 307 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
index 2de0fb81f..0e43a71b1 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
@@ -26,69 +26,98 @@
* or implied, of JogAmp Community.
*/
-
package com.jogamp.opengl.test.junit.jogl.demos.es2;
-import java.nio.*;
+import static javax.media.opengl.GL.*;
+
+import java.nio.FloatBuffer;
-import javax.media.opengl.*;
-import javax.media.opengl.glu.*;
+import javax.media.opengl.GL;
+import javax.media.opengl.GL2ES2;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLUniformData;
-import com.jogamp.common.nio.*;
-import com.jogamp.newt.opengl.*;
-import com.jogamp.opengl.util.*;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.opengl.util.GLArrayDataServer;
+import com.jogamp.opengl.util.PMVMatrix;
import com.jogamp.opengl.util.glsl.ShaderCode;
import com.jogamp.opengl.util.glsl.ShaderProgram;
import com.jogamp.opengl.util.glsl.ShaderState;
-import static javax.media.opengl.GL2ES2.*;
-
/**
- ** __ __|_ ___________________________________________________________________________ ___|__ __
- ** // /\ _ /\ \\
- ** //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\
- ** \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / /
- ** \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/
- ** /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\
- ** / \____\ http://jogamp.org |_| /____/ \
- ** \ / "' _________________________________________________________________________ `" \ /
- ** \/____. .____\/
- **
- ** JOGL2 port of my PC 4k intro competition entry for Revision 2011. Sure it got a little bigger
- ** while porting but the shader and control code remained more or less untouched. The intro renders
- ** a fullscreen billboard using a single fragment shader. The shader encapsulates basically two
- ** different routines: A sphere-tracing based raymarcher for a single fractal formula and a bitmap
- ** orbit trap julia+mandelbrot fractal renderer. Additionally an inline-processing analog-distortion
- ** filter is applied to all rendered fragments to make the overall look more interesting.
- **
- ** The different intro parts are all parameter variations of the two routines in the fragment shader
- ** synched to the music: Parts 3+5 are obviously the mandelbrot and julia bitmap orbit traps, and parts
- ** 1,2,4 and 6 are pure fractal sphere tracing.
- **
- ** During the development of the intro it turned out that perfectly raymarching every pixel of the orbit
- ** trapped julia+mandelbrot fractal was way to slow even on highend hardware. So I inserted a lowres
- ** intermediate FBO to be used by the bitmap based orbit trap routine wich was ofcourse way faster, but
- ** had the obvious upscaling artefacts. Maybe I'll produce a perfect quality version for very patient
- ** people with insane hardware :)
- **
- ** Papers and articles you should be familiar with before trying to understand the code:
- **
- ** Distance rendering for fractals: http://www.iquilezles.org/www/articles/distancefractals/distancefractals.htm
- ** Geometric orbit traps: http://www.iquilezles.org/www/articles/ftrapsgeometric/ftrapsgeometric.htm
- ** Bitmap orbit traps: http://www.iquilezles.org/www/articles/ftrapsbitmap/ftrapsbitmap.htm
- ** Ambient occlusion techniques: http://www.iquilezles.org/www/articles/ao/ao.htm
- ** Sphere tracing: A geometric method for the antialiased ray tracing of implicit surfaces: http://graphics.cs.uiuc.edu/~jch/papers/zeno.pdf
- ** Rendering fractals with distance estimation function: http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
- **
- ** For an impression how this routine looks like see here: http://www.youtube.com/watch?v=lvC8maVHh8Q
- ** Original release from the Revision can be found here: http://www.pouet.net/prod.php?which=56860
- **/
+ * <pre>
+ * __ __|_ ___________________________________________________________________________ ___|__ __
+ * // /\ _ /\ \\
+ * //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\
+ * \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / /
+ * \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/
+ * /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\
+ * / \____\ http://jogamp.org |_| /____/ \
+ * \ / "' _________________________________________________________________________ `" \ /
+ * \/____. .____\/
+ * </pre>
+ *
+ * <p>
+ * JOGL2 port of my PC 4k intro competition entry for Revision 2011. Sure it got a little bigger
+ * while porting but the shader and control code remained more or less untouched. The intro renders
+ * a fullscreen billboard using a single fragment shader. The shader encapsulates basically two
+ * different routines: A sphere-tracing based raymarcher for a single fractal formula and a bitmap
+ * orbit trap julia+mandelbrot fractal renderer. Additionally an inline-processing analog-distortion
+ * filter is applied to all rendered fragments to make the overall look more interesting.
+ * </p>
+ *
+ * <p>
+ * The different intro parts are all parameter variations of the two routines in the fragment shader
+ * synched to the music: Parts 3+5 are obviously the mandelbrot and julia bitmap orbit traps, and parts
+ * 1,2,4 and 6 are pure fractal sphere tracing.
+ * </p>
+ *
+ * <p>
+ * During the development of the intro it turned out that perfectly raymarching every pixel of the orbit
+ * trapped julia+mandelbrot fractal was way to slow even on highend hardware. So I inserted a lowres
+ * intermediate FBO to be used by the bitmap based orbit trap routine wich was ofcourse way faster, but
+ * had the obvious upscaling artefacts. Maybe I'll produce a perfect quality version for very patient
+ * people with insane hardware :)
+ * </p>
+ *
+ * <p>
+ * Papers and articles you should be familiar with before trying to understand the code:
+ * </p>
+ *
+ * <p>
+ * <ul>
+ * <li>Distance rendering for fractals: http://www.iquilezles.org/www/articles/distancefractals/distancefractals.htm</li>
+ * <li>Geometric orbit traps: http://www.iquilezles.org/www/articles/ftrapsgeometric/ftrapsgeometric.htm</li>
+ * <li>Bitmap orbit traps: http://www.iquilezles.org/www/articles/ftrapsbitmap/ftrapsbitmap.htm</li>
+ * <li>Ambient occlusion techniques: http://www.iquilezles.org/www/articles/ao/ao.htm</li>
+ * <li>Sphere tracing: A geometric method for the antialiased ray tracing of implicit surfaces: http://graphics.cs.uiuc.edu/~jch/papers/zeno.pdf</li>
+ * <li>Rendering fractals with distance estimation function: http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm</li>
+ * </ul>
+ * </p>
+ *
+ * <p>
+ * <ul>
+ * <li>For an impression how this routine looks like see here: http://www.youtube.com/watch?v=lvC8maVHh8Q</li>
+ * <li>Original release from the Revision can be found here: http://www.pouet.net/prod.php?which=56860</li>
+ * </ul>
+ * </p>
+ *
+ * <p>
+ * http://www.youtube.com/user/DemoscenePassivist
+ * </p>
+ *
+ * @author Dominik Ströhlein (DemoscenePassivist)
+ */
public class ElektronenMultiplizierer implements GLEventListener {
//BEGIN --- BaseGlobalEnvironment replacement ---
private final GLCapabilities mCaps;
- private final GLU mGlu;
+ // private final GLU mGlu;
private String mCommandLineParameter_BaseRoutineClassName;
private boolean mCommandLineParameter_MultiSampling;
@@ -101,11 +130,9 @@ public class ElektronenMultiplizierer implements GLEventListener {
private int mFrameCounter;
private int mCommandLineParameter_FrameRate;
private long mFrameSkipAverageFramerateTimeStart;
- private boolean mFrameSkipAverageFrameStartTimeInitialized;
private long mFrameSkipAverageFramerateTimeEnd;
- private double mFrameCounterDifference;
- private double mFrameCounterTargetValue;
- private int mSkippedFramesCounter;
+ private boolean mFrameSkipManual;
+ // private int mSkippedFramesCounter;
// private BaseMusic mBaseMusic;
boolean mMusicSyncStartTimeInitialized = false;
@@ -114,7 +141,7 @@ public class ElektronenMultiplizierer implements GLEventListener {
private GLUniformData pmvMatrixUniform;
private GLUniformData mScreenDimensionUniform;
private GLArrayDataServer vertices0;
- private GLArrayDataServer texCoords0;
+ // private GLArrayDataServer texCoords0;
public String getBaseRoutineClassName() { return mCommandLineParameter_BaseRoutineClassName; }
public boolean preferMultiSampling() { return mCommandLineParameter_MultiSampling; }
@@ -133,9 +160,9 @@ public class ElektronenMultiplizierer implements GLEventListener {
boolean inAnisotropicFiltering,
float inAnisotropyLevel,
boolean inFrameCapture,
- boolean inFrameSkip, int desiredFrameRate
+ boolean inFrameSkip, int desiredFrameRate, int startFrame
) {
- mGlu = new GLU();
+ // mGlu = new GLU();
mCommandLineParameter_BaseRoutineClassName = inBaseRoutineClassName;
mCommandLineParameter_MultiSampling = inMultiSampling;
mCommandLineParameter_NumberOfSampleBuffers = (inNumberOfSampleBuffers==-1) ? 2 : inNumberOfSampleBuffers;
@@ -156,6 +183,20 @@ public class ElektronenMultiplizierer implements GLEventListener {
// turns out we need to have alpha, otherwise no AA will be visible
mCaps.setAlphaBits(1);
}
+
+ mFrameSkipAverageFramerateTimeStart = 0;
+ mFrameCounter = 0;
+ skipFrames(startFrame);
+ }
+
+ /**
+ * skip frames by turning back start time
+ * @param frames positive or negative values
+ */
+ public void skipFrames(int frames) {
+ final long dft = 1000000000/mCommandLineParameter_FrameRate;
+ mFrameSkipAverageFramerateTimeStart -= frames * dft ;
+ mFrameSkipManual = true;
}
public GLCapabilitiesImmutable getGLCapabilities() {
@@ -165,14 +206,13 @@ public class ElektronenMultiplizierer implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.setSwapInterval(1);
- mFrameCounter = 0;
st = new ShaderState();
final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
"shader", "shader/bin", "default");
final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
- // "shader", "shader/bin", "elektronenmultiplizierer_development");
- "shader", "shader/bin", "elektronenmultiplizierer_port");
+ "shader", "shader/bin", "elektronenmultiplizierer_development");
+ // "shader", "shader/bin", "elektronenmultiplizierer_port");
final ShaderProgram sp0 = new ShaderProgram();
sp0.add(gl, vp0, System.err);
sp0.add(gl, fp0, System.err);
@@ -203,6 +243,7 @@ public class ElektronenMultiplizierer implements GLEventListener {
st.ownAttribute(vertices0, true);
vertices0.enableBuffer(gl, false);
+ /**
texCoords0 = GLArrayDataServer.createGLSL("gca_TexCoords", 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW);
texCoords0.putf(0f); texCoords0.putf(1f);
texCoords0.putf(1f); texCoords0.putf(1f);
@@ -210,7 +251,7 @@ public class ElektronenMultiplizierer implements GLEventListener {
texCoords0.putf(1f); texCoords0.putf(0f);
texCoords0.seal(gl, true);
st.ownAttribute(texCoords0, true);
- texCoords0.enableBuffer(gl, false);
+ texCoords0.enableBuffer(gl, false); */
//generate framebufferobject
int[] result = new int[1];
@@ -239,22 +280,38 @@ public class ElektronenMultiplizierer implements GLEventListener {
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ // if NO music is used sync to mainloop start ...
+ // (add up current time due to possible turned back start time by skip frames)
+ mFrameSkipAverageFramerateTimeStart += System.nanoTime();
+
// mBaseMusic = new BaseMusic(BaseGlobalEnvironment.getInstance().getMusicFileName());
// mBaseMusic.init();
// mBaseMusic.play();
}
public void display(GLAutoDrawable drawable) {
+ if (wantsFrameSkip()) {
+ mFrameSkipAverageFramerateTimeEnd = System.nanoTime();
+ double tDesiredFrameRate = (float)getDesiredFramerate();
+ double tSingleFrameTime = 1000000000.0f/tDesiredFrameRate;
+ double tElapsedTime = mFrameSkipAverageFramerateTimeEnd - mFrameSkipAverageFramerateTimeStart;
+ double mFrameCounterTargetValue = tElapsedTime/tSingleFrameTime;
+ double mFrameCounterDifference = mFrameCounterTargetValue-mFrameCounter;
+ if (mFrameSkipManual || mFrameCounterDifference>2) {
+ mFrameCounter+=mFrameCounterDifference;
+ // mSkippedFramesCounter+=mFrameCounterDifference;
+ } else if (mFrameCounterDifference<-2) {
+ //hold framecounter advance ...
+ mFrameCounter--;
+ }
+ mFrameSkipManual = false;
+ }
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
final int XRES = drawable.getWidth();
final int YRES = drawable.getHeight();
- //if NO music is used sync to mainloop start ...
- if (!mFrameSkipAverageFrameStartTimeInitialized) {
- mFrameSkipAverageFrameStartTimeInitialized = true;
- mFrameSkipAverageFramerateTimeStart = System.nanoTime();
- }
// if (!getBaseMusic().isOffline()) {
// //if music IS used sync to first second of music ...
// if (BaseRoutineRuntime.getInstance().getBaseMusic().getPositionInMilliseconds()>0 && !mMusicSyncStartTimeInitialized) {
@@ -267,7 +324,7 @@ public class ElektronenMultiplizierer implements GLEventListener {
// mBaseMusic.synchonizeMusic();
//use this for offline rendering/capture ...
- int MMTime_u_ms = (int)((((double)mFrameCounter)*44100.0f)/60.0f);
+ int MMTime_u_ms = (int)((((float)mFrameCounter)*44100.0f)/60.0f);
//use this for music synched rendering ...
//int MMTime_u_ms = (int)(BaseRoutineRuntime.getInstance().getBaseMusic().getPositionInMilliseconds()*(44100.0f/1000.0f));
//dedicated sync variable for each event ... kinda lame but who cares X-)
@@ -280,14 +337,14 @@ public class ElektronenMultiplizierer implements GLEventListener {
if (MMTime_u_ms>=4438408 && !mSyncEvent_07) { mSyncEvent_07 = true; handleSyncEvent(MMTime_u_ms); }
if (MMTime_u_ms>=5482831 && !mSyncEvent_08) { mSyncEvent_08 = true; handleSyncEvent(MMTime_u_ms); }
//calculate current time based on 60fps reference framerate ...
- MMTime_u_ms = (int)((((double)mFrameCounter)*44100.0)/60.0);
+ MMTime_u_ms = (int)((((float)mFrameCounter)*44100.0f)/60.0f);
gl.glDisable(GL_CULL_FACE);
gl.glDisable(GL_DEPTH_TEST);
st.useProgram(gl, true);
vertices0.enableBuffer(gl, true);
- texCoords0.enableBuffer(gl, true);
+ // texCoords0.enableBuffer(gl, true);
pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
@@ -378,27 +435,11 @@ public class ElektronenMultiplizierer implements GLEventListener {
gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
vertices0.enableBuffer(gl, false);
- texCoords0.enableBuffer(gl, false);
+ // texCoords0.enableBuffer(gl, false);
st.useProgram(gl, false);
//---
mFrameCounter++;
- if (wantsFrameSkip()) {
- mFrameSkipAverageFramerateTimeEnd = System.nanoTime();
- double tDesiredFrameRate = (float)getDesiredFramerate();
- double tSingleFrameTime = 1000000000.0f/tDesiredFrameRate;
- double tElapsedTime = mFrameSkipAverageFramerateTimeEnd - mFrameSkipAverageFramerateTimeStart;
- mFrameCounterTargetValue = tElapsedTime/tSingleFrameTime;
- mFrameCounterDifference = mFrameCounterTargetValue-mFrameCounter;
- if (mFrameCounterDifference>2) {
- mFrameCounter+=mFrameCounterDifference;
- mSkippedFramesCounter+=mFrameCounterDifference;
- } else if (mFrameCounterDifference<-2) {
- //hold framecounter advance ...
- mFrameCounter--;
- }
- }
-
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
@@ -466,45 +507,5 @@ public class ElektronenMultiplizierer implements GLEventListener {
mEffectSyncTime = inMMTime_u_ms;
}
}
-
-
-//BEGIN --- main entry point ---
-
- public static void main(String args[]) throws Exception {
- String tRoutineClassName = null;
- boolean tMultiSampling = false;
- int tNumberOfSampleBuffers = -1;
- boolean tAnisotropicFiltering = false;
- float tAnisotropyLevel = -1.0f;
- boolean tFrameCapture = false;
- boolean tFrameSkip = true;
- int desiredFrameRate = 30;
-
- final ElektronenMultiplizierer demo = new ElektronenMultiplizierer(
- tRoutineClassName,
- tMultiSampling,tNumberOfSampleBuffers,
- tAnisotropicFiltering,tAnisotropyLevel,
- tFrameCapture,
- tFrameSkip, desiredFrameRate
- );
- GLCapabilitiesImmutable caps = demo.getGLCapabilities();
-
- GLWindow glWindow = GLWindow.create(caps);
- glWindow.setSize(640, 480);
- glWindow.setTitle("Jogamp.org - ElektronenMultiplizierer - GL2ES2/NEWT");
- glWindow.addGLEventListener(demo);
- final Animator animator = new Animator(glWindow);
- animator.setUpdateFPSFrames(60, System.err);
- glWindow.addWindowListener(new com.jogamp.newt.event.WindowAdapter() {
- public void windowDestroyNotify(com.jogamp.newt.event.WindowEvent e) {
- animator.stop();
- System.exit(0);
- }
- });
- glWindow.setVisible(true);
- animator.start();
- }
-
-//END --- main entry point ---
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
new file mode 100644
index 000000000..26917107d
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
@@ -0,0 +1,160 @@
+/**
+ * Copyright 2011 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
+
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+
+import com.jogamp.opengl.util.Animator;
+
+import com.jogamp.opengl.test.junit.jogl.demos.es2.ElektronenMultiplizierer;
+
+import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLProfile;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.Test;
+
+/**
+ * @see com.jogamp.opengl.test.junit.jogl.demos.es2.ElektronenMultiplizierer
+ * @author Dominik Ströhlein (DemoscenePassivist), et.al.
+ */
+public class TestElektronenMultipliziererNEWT extends UITestCase {
+ static final int width = 640, height = 480;
+
+ static final String tRoutineClassName = null;
+ static final boolean tMultiSampling = false;
+ static final int tNumberOfSampleBuffers = -1;
+ static final boolean tAnisotropicFiltering = false;
+ static final float tAnisotropyLevel = -1.0f;
+ static final boolean tFrameCapture = false;
+ static final boolean tFrameSkip = true;
+ static final int desiredFrameRate = 30;
+ static int startFrame = 1700;
+ static long duration = 5000; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ }
+
+ @AfterClass
+ public static void releaseClass() {
+ }
+
+ protected void run() throws InterruptedException {
+ final ElektronenMultiplizierer demo = new ElektronenMultiplizierer(
+ tRoutineClassName,
+ tMultiSampling,tNumberOfSampleBuffers,
+ tAnisotropicFiltering,tAnisotropyLevel,
+ tFrameCapture,
+ tFrameSkip, desiredFrameRate, startFrame
+ );
+ GLCapabilitiesImmutable caps = demo.getGLCapabilities();
+
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setSize(width, height);
+ glWindow.setTitle("ElektronenMultiplizierer (GL2ES2/NEWT)");
+ glWindow.addGLEventListener(demo);
+
+ Animator animator = new Animator(glWindow);
+ animator.setUpdateFPSFrames(60, System.err);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
+ glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ glWindow.addKeyListener(quitAdapter);
+ glWindow.addWindowListener(quitAdapter);
+
+ final GLWindow f_glWindow = glWindow;
+ glWindow.addKeyListener(new KeyAdapter() {
+ public void keyTyped(KeyEvent e) {
+ if(e.getKeyChar()=='f') {
+ new Thread() {
+ public void run() {
+ f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
+ } }.start();
+ } else if(e.getKeyChar()=='d') {
+ new Thread() {
+ public void run() {
+ f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
+ } }.start();
+ }
+ }
+ public void keyPressed(KeyEvent e) {
+ if(KeyEvent.VK_RIGHT == e.getKeyCode()) {
+ demo.skipFrames(120);
+ System.err.println("->");
+ } else if(KeyEvent.VK_LEFT == e.getKeyCode()) {
+ demo.skipFrames(-120);
+ System.err.println("<-");
+ }
+ }
+ });
+
+ glWindow.setVisible(true);
+ animator.start();
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
+ Thread.sleep(100);
+ }
+ animator.stop();
+ glWindow.destroy();
+ }
+
+ @Test
+ public void testElektronenMultiplizierer01() throws InterruptedException {
+ run();
+ }
+
+ public static void main(String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ try {
+ duration = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ if(args[i].equals("-sframe")) {
+ i++;
+ try {
+ startFrame = Integer.parseInt(args[i]);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestElektronenMultipliziererNEWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp
index 6b89e6670..b5979d740 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_development.fp
@@ -1,63 +1,14 @@
/**
* Copyright 2011 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
*
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
+ * Details see: src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
*/
/**
- ** __ __|_ ___________________________________________________________________________ ___|__ __
- ** // /\ _ /\ \\
- ** //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\
- ** \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / /
- ** \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/
- ** /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\
- ** / \____\ http://jogamp.org |_| /____/ \
- ** \ / "' _________________________________________________________________________ `" \ /
- ** \/____. .____\/
- **
- ** JOGL2 port of my PC 4k intro competition entry for Revision 2011. The shader encapsulates basically
- ** two different routines: A sphere-tracing based raymarcher for a single fractal formula and a bitmap
- ** orbit trap julia+mandelbrot fractal renderer. Additionally an inline-processing analog-distortion
- ** filter is applied to all rendered fragments to make the overall look more interesting.
- **
- ** Papers and articles you should be familiar with before trying to understand the code:
- **
- ** Distance rendering for fractals: http://www.iquilezles.org/www/articles/distancefractals/distancefractals.htm
- ** Geometric orbit traps: http://www.iquilezles.org/www/articles/ftrapsgeometric/ftrapsgeometric.htm
- ** Bitmap orbit traps: http://www.iquilezles.org/www/articles/ftrapsbitmap/ftrapsbitmap.htm
- ** Ambient occlusion techniques: http://www.iquilezles.org/www/articles/ao/ao.htm
- ** Sphere tracing: A geometric method for the antialiased ray tracing of implicit surfaces: http://graphics.cs.uiuc.edu/~jch/papers/zeno.pdf
- ** Rendering fractals with distance estimation function: http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
- **
- ** For an impression how this routine looks like see here: http://www.youtube.com/watch?v=lvC8maVHh8Q
- ** Original release from the Revision can be found here: http://www.pouet.net/prod.php?which=56860
+ * http://www.youtube.com/user/DemoscenePassivist
+ * author: Dominik Ströhlein (DemoscenePassivist)
**/
-//When I wrote this, only God and I understood what I was doing ...
-// ... now only God knows! X-)
-
#ifdef GL_ES
#define MEDIUMP mediump
#define HIGHP highp
@@ -68,22 +19,22 @@
#define LOWP
#endif
-uniform HIGHP int en; //effectnumber
-uniform HIGHP float et; //effecttime
-uniform HIGHP sampler2D fb; //fbotexture
-uniform HIGHP float br; //brightness
-uniform HIGHP float tm; //time
-uniform HIGHP vec2 resolution;//screen resolution/fbo resolution
+uniform MEDIUMP int en; //effectnumber
+uniform MEDIUMP float et; //effecttime
+uniform MEDIUMP sampler2D fb; //fbotexture
+uniform MEDIUMP float br; //brightness
+uniform MEDIUMP float tm; //time
+uniform MEDIUMP vec2 resolution;//screen resolution/fbo resolution
-float camerafocallengthdode;
-vec3 camerapositiondode;
-vec2 sizedode;
-vec3 backgroundcolor = vec3(0,0.6,0.46);
-mat3 worldrotationxyz;
-mat3 fractalplanerotationx;
-mat3 fractalplanerotationy;
-mat3 camerarotationdode;
-vec2 oglFragCoord;
+MEDIUMP float camerafocallengthdode;
+MEDIUMP vec3 camerapositiondode;
+MEDIUMP vec2 sizedode;
+MEDIUMP vec3 backgroundcolor = vec3(0,0.6,0.46);
+MEDIUMP mat3 worldrotationxyz;
+MEDIUMP mat3 fractalplanerotationx;
+MEDIUMP mat3 fractalplanerotationy;
+MEDIUMP mat3 camerarotationdode;
+MEDIUMP vec2 oglFragCoord;
//fractal formula used for sphreretracing/distance-estimation
//dodecahedron serpinski (knighty)
@@ -92,29 +43,29 @@ vec2 oglFragCoord;
//(phi^2, 1, -phi), (-phi, phi^2, 1), (1, -phi, phi^2), (-phi*(1+phi), phi^2-1, 1+phi), (1+phi, -phi*(1+phi), phi^2-1) and x=0, y=0, z=0 planes.
//const pre-calc
-const float phi = 1.618;
-const float _IKVNORM_ = 1.0 / sqrt(pow(phi * (1.0 + phi), 2.0) + pow(phi * phi - 1.0, 2.0) + pow(1.0 + phi, 2.0));
-const float _C1_ = phi * (1.0 + phi) * _IKVNORM_;
-const float _C2_ = (phi * phi - 1.0) * _IKVNORM_;
-const float _1C_ = (1.0 + phi) * _IKVNORM_;
-const vec3 phi3 = vec3(0.5, 0.5 / phi, 0.5 * phi);
-const vec3 c3 = vec3(_C1_, _C2_, _1C_);
+const MEDIUMP float phi = 1.618;
+const MEDIUMP float _IKVNORM_ = 1.0 / sqrt(pow(phi * (1.0 + phi), 2.0) + pow(phi * phi - 1.0, 2.0) + pow(1.0 + phi, 2.0));
+const MEDIUMP float _C1_ = phi * (1.0 + phi) * _IKVNORM_;
+const MEDIUMP float _C2_ = (phi * phi - 1.0) * _IKVNORM_;
+const MEDIUMP float _1C_ = (1.0 + phi) * _IKVNORM_;
+const MEDIUMP vec3 phi3 = vec3(0.5, 0.5 / phi, 0.5 * phi);
+const MEDIUMP vec3 c3 = vec3(_C1_, _C2_, _1C_);
-vec3 distancefunction(vec3 w) {
+MEDIUMP vec3 distancefunction(MEDIUMP vec3 w) {
//!P center scale offset ...
- vec3 offset;
+ MEDIUMP vec3 offset;
if (en==6) {
offset = vec3(0.61,0.1*et,0.99);
} else {
offset = vec3(0.61,0.0,0.99);
}
//!P center scale \0/ this is awesome for fadeins !!!
- float scale = 2.;
+ MEDIUMP float scale = 2.;
w *= worldrotationxyz;
- float d, t;
- float md = 1000.0, cd = 0.0;
+ MEDIUMP float d, t;
+ MEDIUMP float md = 1000.0, cd = 0.0;
//!P iterations (8) ... 2x see below
- for (int i = 0; i < 8; i++) {
+ for (MEDIUMP int i = 0; i < 8; i++) {
w *= fractalplanerotationx;
w = abs(w);
t = w.x * phi3.z + w.y * phi3.y - w.z * phi3.x;
@@ -139,33 +90,33 @@ vec3 distancefunction(vec3 w) {
}
}
//!P max iterations (8)
- return vec3((length(w) - 2.0) * pow(scale, -8.0), md, cd);
+ return MEDIUMP vec3((length(w) - 2.0) * pow(scale, -8.0), md, cd);
}
//calculate ray direction fragment coordinates
-vec3 raydirection(vec2 pixel) {
- vec2 p = (0.5*sizedode-pixel)/vec2(sizedode.x,-sizedode.y);
+MEDIUMP vec3 raydirection(MEDIUMP vec2 pixel) {
+ MEDIUMP vec2 p = (0.5*sizedode-pixel)/vec2(sizedode.x,-sizedode.y);
//!P aspect ratio of dode
p.x *= sizedode.x/sizedode.y;
//!P vec3 w = vec3(0, 0, 1), vec3 v = vec3(0, 1, 0), vec3 u = vec3(1, 0, 0);
- vec3 d = (p.x * vec3(1, 0, 0)+p.y * vec3(0, 1, 0)-camerafocallengthdode * vec3(0, 0, 1));
+ MEDIUMP vec3 d = (p.x * vec3(1, 0, 0)+p.y * vec3(0, 1, 0)-camerafocallengthdode * vec3(0, 0, 1));
return normalize(camerarotationdode * d);
}
//iq's fake ambient occlusion
//http://www.iquilezles.org/www/material/nvscene2008/rwwtt.pdf
//http://www.iquilezles.org/www/articles/ao/ao.htm
-float ambientocclusion(vec3 p, vec3 n, float eps) {
- float o = 1.0;
+MEDIUMP float ambientocclusion(MEDIUMP vec3 p, MEDIUMP vec3 n, MEDIUMP float eps) {
+ MEDIUMP float o = 1.0;
//!P ao spread (10.6)
// spreads the output color intensity
eps *= 10.6;
//!P ao intensity (0.16)
- float k = 0.16 / eps;
+ MEDIUMP float k = 0.16 / eps;
//add little start distance to the surface
- float d = 2.0 * eps;
+ MEDIUMP float d = 2.0 * eps;
//!P ao iterations (5) ...
- for (int i = 0; i < 5; ++i) {
+ for (MEDIUMP int i = 0; i < 5; ++i) {
o -= (d - distancefunction(p + n * d).x) * k;
d += eps;
//fade ao when distance to the surface increases
@@ -174,28 +125,28 @@ float ambientocclusion(vec3 p, vec3 n, float eps) {
return clamp(o, 0.0, 1.0);
}
-vec4 render(vec2 pixel) {
- vec3 ray_direction = raydirection(pixel);
+MEDIUMP vec4 render(vec2 pixel) {
+ MEDIUMP vec3 ray_direction = raydirection(pixel);
//!P minimum ray length (6e-5)
- float ray_length = 6e-5;
- vec3 ray = camerapositiondode + ray_length * ray_direction;
+ MEDIUMP float ray_length = 6e-5;
+ MEDIUMP vec3 ray = camerapositiondode + ray_length * ray_direction;
//!P minimum epsilon (6e-7) ...
- float eps = 6e-7;
- vec3 dist;
- vec3 normal = vec3(0);
- int steps = 0;
- bool hit = false;
- float minmarch = 0.0;
+ MEDIUMP float eps = 6e-7;
+ MEDIUMP vec3 dist;
+ MEDIUMP vec3 normal = vec3(0);
+ MEDIUMP int steps = 0;
+ MEDIUMP bool hit = false;
+ MEDIUMP float minmarch = 0.0;
//!P maxmarch = 10000.0;
- float maxmarch = 25.0;
+ MEDIUMP float maxmarch = 25.0;
//!P field of view scale = (1.0 / sqrt(1.0 + camerafocallengthdode * camerafocallengthdode))
//!P detail of surface approximation = 1.22
//!P pixelscale = (1.0 / min(sizedode.x, sizedode.y))
- float epsfactor = 2.0 * (1.0 / sqrt(1.0 + camerafocallengthdode * camerafocallengthdode)) * (1.0 / min(sizedode.x, sizedode.y)) * 1.22;
+ MEDIUMP float epsfactor = 2.0 * (1.0 / sqrt(1.0 + camerafocallengthdode * camerafocallengthdode)) * (1.0 / min(sizedode.x, sizedode.y)) * 1.22;
ray_length = minmarch;
ray = camerapositiondode + ray_length * ray_direction;
//!P max number of raymarching steps (90);
- for (int i = 0; i < 90; i++) {
+ for (MEDIUMP int i = 0; i < 90; i++) {
steps = i;
dist = distancefunction(ray);
//!P X-) questionable surface smoothing (0.53)
@@ -214,15 +165,15 @@ vec4 render(vec2 pixel) {
}
}
//\0/ there is a hit!
- vec4 color = vec4(backgroundcolor,0.5);
+ MEDIUMP vec4 color = vec4(backgroundcolor,0.5);
if (hit) {
- float aof = 1.0;
+ MEDIUMP float aof = 1.0;
if (steps < 1 || ray_length < minmarch) {
normal = normalize(ray);
} else {
//gradient in x,y and z direction for intersection point
//!P minimum normal (1.5e-7)
- float e = max(eps * 0.5, 1.5e-7);
+ MEDIUMP float e = max(eps * 0.5, 1.5e-7);
normal = normalize(vec3(
distancefunction(ray + vec3(e, 0, 0)).x - distancefunction(ray - vec3(e, 0, 0)).x,
distancefunction(ray + vec3(0, e, 0)).x - distancefunction(ray - vec3(0, e, 0)).x,
@@ -231,7 +182,7 @@ vec4 render(vec2 pixel) {
aof = ambientocclusion(ray, normal, eps);
}
//!P hardcoded light position vec3(-50,150,-25)
- float diffuse = max(dot(normal, normalize(vec3(-50,150,-25) - ray)), 0.0);
+ MEDIUMP float diffuse = max(dot(normal, normalize(vec3(-50,150,-25) - ray)), 0.0);
//blinn/phong specular stuff ...
//!P specular exponent (4)
//!P specularity (0.8)
@@ -245,39 +196,39 @@ vec4 render(vec2 pixel) {
return color;
}
-mat3 xmatrixrotation(float angle) {
- return mat3(
+MEDIUMP mat3 xmatrixrotation(MEDIUMP float angle) {
+ return MEDIUMP mat3(
vec3(1.0, 0.0, 0.0),
vec3(0.0, cos(angle), sin(angle)),
vec3(0.0, -sin(angle), cos(angle))
);
}
-mat3 ymatrixrotation(float angle) {
- return mat3(
+MEDIUMP mat3 ymatrixrotation(MEDIUMP float angle) {
+ return MEDIUMP mat3(
vec3(cos(angle), 0.0, -sin(angle)),
vec3( 0.0, 1.0, 0.0),
vec3(sin(angle), 0.0, cos(angle))
);
}
-vec4 raymarch_orbittrap_image(vec2 fragcoord) {
+MEDIUMP vec4 raymarch_orbittrap_image(MEDIUMP vec2 fragcoord) {
//do the matrix calculations by hand X-)
//as mat4 constructor and arithmetic assignments are
//currently broken (2010-09-21) on ATI cards i found
//a workaround using vec4 constructors wich works on
//both NVIDIA+ATI --- MAGIC. DO NOT TOUCH! -=#:-)
- mat3 identitymatrix = mat3(1,0,0,0,1,0,0,0,1);
- float sin_phi = sin(0.1*tm);
- float cos_phi = cos(0.1*tm);
- mat3 zrot = mat3(
+ MEDIUMP mat3 identitymatrix = mat3(1,0,0,0,1,0,0,0,1);
+ MEDIUMP float sin_phi = sin(0.1*tm);
+ MEDIUMP float cos_phi = cos(0.1*tm);
+ MEDIUMP mat3 zrot = MEDIUMP mat3(
vec3( cos_phi, sin_phi, 0.0),
vec3(-sin_phi, cos_phi, 0.0),
vec3( 0.0, 0.0, 1.0)
);
- vec2 position;
- float fractalplanex_var;
- float fractalplaney_var;
+ MEDIUMP vec2 position;
+ MEDIUMP float fractalplanex_var;
+ MEDIUMP float fractalplaney_var;
position = oglFragCoord.xy;
camerafocallengthdode = 1.0;
if (en==2) {
@@ -308,16 +259,16 @@ vec4 raymarch_orbittrap_image(vec2 fragcoord) {
fractalplanerotationx = xmatrixrotation(fractalplanex_var)*identitymatrix;
fractalplanerotationy = xmatrixrotation(fractalplaney_var)*identitymatrix;
camerarotationdode = ymatrixrotation(3.14)*identitymatrix;
- vec4 color = render(position);
+ MEDIUMP vec4 color = render(position);
return color;
}
//----------------------------------------------------------------------------------------------------------
-vec4 orbitmapping(vec4 c, vec2 w) {
+MEDIUMP vec4 orbitmapping(MEDIUMP vec4 c, MEDIUMP vec2 w) {
//!P orbit trap scale and offset
- vec2 orbittrapoffset = vec2(0.24,-0.24);
- float orbittrapscale;
+ MEDIUMP vec2 orbittrapoffset = vec2(0.24,-0.24);
+ MEDIUMP float orbittrapscale;
if (en==0) {
//julia set ...
orbittrapscale = 0.625;
@@ -333,12 +284,12 @@ vec4 orbitmapping(vec4 c, vec2 w) {
return c;
}
-vec4 orbittrap(vec2 z) {
- float powerjulia = 2.;
- vec3 colorjulia = vec3(1.0);
- vec4 color = vec4(colorjulia, 0.0);
- float n = 0.0;
- vec2 c;
+MEDIUMP vec4 orbittrap(MEDIUMP vec2 z) {
+ MEDIUMP float powerjulia = 2.;
+ MEDIUMP vec3 colorjulia = vec3(1.0);
+ MEDIUMP vec4 color = vec4(colorjulia, 0.0);
+ MEDIUMP float n = 0.0;
+ MEDIUMP vec2 c;
if (en==0) {
//julia mode ...
//!P use offset-julia from 2.25 to 2.5
@@ -363,20 +314,20 @@ vec4 orbittrap(vec2 z) {
}
}
//!P max iterations for julia (128.0) ...
- float blend = clamp(1.0 - (n / 128.0) * 2.0, 0.0, 1.0);
+ MEDIUMP float blend = clamp(1.0 - (n / 128.0) * 2.0, 0.0, 1.0);
color.rgb = mix(colorjulia, color.rgb, blend);
return color;
}
void main() {
- vec2 sizejulia = resolution;
+ MEDIUMP vec2 sizejulia = resolution;
sizedode = sizejulia;
oglFragCoord = gl_FragCoord.xy;
- vec4 color;
+ MEDIUMP vec4 color;
if (en==0 || en==1) {
//render 2d julia/mandelbrot
//!P camera position for julia ...
- vec3 camerapositionjulia;
+ MEDIUMP vec3 camerapositionjulia;
if (en==0) {
//julia
camerapositionjulia = vec3(-0.2,-0.515,0.095347+(et*1.75));
@@ -385,7 +336,7 @@ void main() {
camerapositionjulia = vec3(0.325895,0.049551,0.0005+et);
}
//!P absolute output size of julia orbit trap ...
- vec2 z = ((oglFragCoord.xy - (sizejulia * 0.5)) / sizejulia) *
+ MEDIUMP vec2 z = ((oglFragCoord.xy - (sizejulia * 0.5)) / sizejulia) *
vec2(sizejulia.x/sizejulia.y, 1.0) * //aspect ratio
camerapositionjulia.z +
camerapositionjulia.xy;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp
index fdd159616..40f1b835b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/shader/elektronenmultiplizierer_port.fp
@@ -1,58 +1,12 @@
/**
* Copyright 2011 JogAmp Community. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
*
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of JogAmp Community.
+ * Details see: src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java
*/
/**
- ** __ __|_ ___________________________________________________________________________ ___|__ __
- ** // /\ _ /\ \\
- ** //____/ \__ __ _____ _____ _____ _____ _____ | | __ _____ _____ __ __/ \____\\
- ** \ \ / / __| | | __| _ | | _ | | | __| | | __| | /\ \ / /
- ** \____\/_/ | | | | | | | | | | | __| | | | | | | | | | |__ " \_\/____/
- ** /\ \ |_____|_____|_____|__|__|_|_|_|__| | | |_____|_____|_____|_____| _ / /\
- ** / \____\ http://jogamp.org |_| /____/ \
- ** \ / "' _________________________________________________________________________ `" \ /
- ** \/____. .____\/
- **
- ** JOGL2 port of my PC 4k intro competition entry for Revision 2011. The shader encapsulates basically
- ** two different routines: A sphere-tracing based raymarcher for a single fractal formula and a bitmap
- ** orbit trap julia+mandelbrot fractal renderer. Additionally an inline-processing analog-distortion
- ** filter is applied to all rendered fragments to make the overall look more interesting.
- **
- ** Papers and articles you should be familiar with before trying to understand the code:
- **
- ** Distance rendering for fractals: http://www.iquilezles.org/www/articles/distancefractals/distancefractals.htm
- ** Geometric orbit traps: http://www.iquilezles.org/www/articles/ftrapsgeometric/ftrapsgeometric.htm
- ** Bitmap orbit traps: http://www.iquilezles.org/www/articles/ftrapsbitmap/ftrapsbitmap.htm
- ** Ambient occlusion techniques: http://www.iquilezles.org/www/articles/ao/ao.htm
- ** Sphere tracing: A geometric method for the antialiased ray tracing of implicit surfaces: http://graphics.cs.uiuc.edu/~jch/papers/zeno.pdf
- ** Rendering fractals with distance estimation function: http://www.iquilezles.org/www/articles/mandelbulb/mandelbulb.htm
- **
- ** For an impression how this routine looks like see here: http://www.youtube.com/watch?v=lvC8maVHh8Q
- ** Original release from the Revision can be found here: http://www.pouet.net/prod.php?which=56860
+ * http://www.youtube.com/user/DemoscenePassivist
+ * author: Dominik Ströhlein (DemoscenePassivist)
**/
//When I wrote this, only God and I understood what I was doing ...