aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-09-05 09:56:40 +0200
committerSven Gothel <[email protected]>2013-09-05 09:56:40 +0200
commit7ee9b87bdb025f98651c2685d416029a17fc3937 (patch)
tree7a533a3080da97bdfa11cc2d31c95976574f9e52 /src
parent604434f8a1ea43f306e21fe81ac7471f27e3c9cf (diff)
TileRendererBase: Add toString(), Proper tile unit test names, i.e. add NEWT for UI agnostic (no-awt tests).
Diffstat (limited to 'src')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java3
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2.java)4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2.java)4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2GL2NEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2GL2.java)4
6 files changed, 22 insertions, 16 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
index 9a9b94fa9..71e284101 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelBuffer.java
@@ -254,7 +254,8 @@ public class GLPixelBuffer {
sb = new StringBuilder();
}
sb.append(pixelAttributes).append(", dim ").append(width).append("x").append(height).append("x").append(depth).append(", pack ").append(pack)
- .append(", disposed ").append(disposed).append(", valid ").append(isValid()).append(", buffer[sz [bytes ").append(byteSize).append(", elemSize ").append(bufferElemSize).append(", ").append(buffer).append("]");
+ .append(", disposed ").append(disposed).append(", valid ").append(isValid())
+ .append(", buffer[bytes ").append(byteSize).append(", elemSize ").append(bufferElemSize).append(", ").append(buffer).append("]");
return sb;
}
public String toString() {
diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
index 8779fa59f..b6774b6b7 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/TileRendererBase.java
@@ -37,6 +37,7 @@
package com.jogamp.opengl.util;
import javax.media.nativewindow.util.Dimension;
+import javax.media.nativewindow.util.DimensionImmutable;
import javax.media.opengl.GL2ES3;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -109,6 +110,14 @@ public abstract class TileRendererBase {
protected GLEventListener glEventListenerPre = null;
protected GLEventListener glEventListenerPost = null;
+ public String toString() {
+ final int gladListenerCount = null != listeners ? listeners.length : 0;
+ return getClass().getSimpleName()+
+ "[tile["+currentTileXPos+"/"+currentTileYPos+" "+currentTileWidth+"x"+currentTileHeight+", buffer "+tileBuffer+"], "+
+ ", image[size "+imageSize+", buffer "+imageBuffer+"], glad["+
+ gladListenerCount+" listener, pre "+(null!=glEventListenerPre)+", post "+(null!=glEventListenerPost)+"]]";
+ }
+
protected TileRendererBase() {
}
@@ -147,7 +156,7 @@ public abstract class TileRendererBase {
}
/** @see #setImageSize(int, int) */
- public final Dimension getImageSize() { return imageSize; }
+ public final DimensionImmutable getImageSize() { return imageSize; }
/**
* Sets the buffer in which to store the final image
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java
index 1efc95c9e..866a8a753 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java
@@ -69,7 +69,7 @@ import org.junit.runners.MethodSorters;
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestRandomTiledRendering2GL2 extends UITestCase {
+public class TestRandomTiledRendering2GL2NEWT extends UITestCase {
static long duration = 500; // ms
@Test
@@ -180,6 +180,6 @@ public class TestRandomTiledRendering2GL2 extends UITestCase {
} catch (Exception ex) { ex.printStackTrace(); }
}
}
- org.junit.runner.JUnitCore.main(TestRandomTiledRendering2GL2.class.getName());
+ org.junit.runner.JUnitCore.main(TestRandomTiledRendering2GL2NEWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
index 26e53c17b..28ff19bad 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
@@ -139,13 +139,13 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
} else {
flipVertically[0] = true;
}
+ System.err.println("XXX pre-init: "+renderer);
}
@Override
public void dispose(GLAutoDrawable drawable) {}
@Override
public void display(GLAutoDrawable drawable) {
if( dx+w <= imageWidth && dy+h <= imageHeight ) {
- System.err.println("XXX setTileRect["+dx+"/"+dy+" "+w+"x"+h+"]");
renderer.setTileRect(dx, dy, w, h);
dx+=w+w/2;
if( dx + w > imageWidth ) {
@@ -153,9 +153,9 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
dy+=h+h/2;
}
} else if( rendererActive[0] ) {
- System.err.println("XXX active -> false");
rendererActive[0] = false;
}
+ System.err.println("XXX pre-display: "+renderer);
}
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
@@ -171,7 +171,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
final GLPixelBuffer imageBuffer = renderer.getImageBuffer();
imageBuffer.clear(); // full size available
System.err.println("XXX !active -> save");
- System.err.println("XXX2: "+imageBuffer);
+ System.err.println("XXX post-display: "+renderer);
final TextureData textureData = new TextureData(
caps.getGLProfile(),
0 /* internalFormat */,
@@ -182,7 +182,6 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
flipVertically[0],
imageBuffer.buffer,
null /* Flusher */);
- System.err.println("XXX3: "+textureData.getPixelFormat()+", "+textureData.getPixelAttributes());
try {
final String filename = getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null);
final File file = new File(filename);
@@ -192,8 +191,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
}
gears.setTileRenderer(null);
renderer.detachFromAutoDrawable();
- System.err.println("XXX detach: glel "+glad.getGLEventListener(0));
- System.err.println("XXX detach: "+animator);
+ System.err.println("XXX post-display detached: "+renderer);
drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight());
glad.getGLEventListener(0).reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight());
gears.setDoRotation(true);
@@ -223,8 +221,6 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
System.err.println("XXX START TILE RENDERING");
gears.setTileRenderer(renderer);
renderer.attachToAutoDrawable(glad);
- System.err.println("XXX attach: glel "+glad.getGLEventListener(0));
- System.err.println("XXX attach: "+animator);
}
Thread.sleep(100);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java
index 24466e32e..c80a0cadd 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java
@@ -64,7 +64,7 @@ import org.junit.runners.MethodSorters;
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestTiledRendering1GL2 extends UITestCase {
+public class TestTiledRendering1GL2NEWT extends UITestCase {
static long duration = 500; // ms
@Test
@@ -169,6 +169,6 @@ public class TestTiledRendering1GL2 extends UITestCase {
} catch (Exception ex) { ex.printStackTrace(); }
}
}
- org.junit.runner.JUnitCore.main(TestTiledRendering1GL2.class.getName());
+ org.junit.runner.JUnitCore.main(TestTiledRendering1GL2NEWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2GL2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2GL2NEWT.java
index 6fd13538b..72917bc7f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2GL2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2GL2NEWT.java
@@ -69,7 +69,7 @@ import org.junit.runners.MethodSorters;
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
-public class TestTiledRendering2GL2 extends UITestCase {
+public class TestTiledRendering2GL2NEWT extends UITestCase {
static long duration = 500; // ms
@Test
@@ -170,6 +170,6 @@ public class TestTiledRendering2GL2 extends UITestCase {
} catch (Exception ex) { ex.printStackTrace(); }
}
}
- org.junit.runner.JUnitCore.main(TestTiledRendering2GL2.class.getName());
+ org.junit.runner.JUnitCore.main(TestTiledRendering2GL2NEWT.class.getName());
}
}