diff options
author | Sven Gothel <[email protected]> | 2013-09-27 07:13:24 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-27 07:13:24 +0200 |
commit | 4ef53cf2ae509a625795bfa3a8982ce75e24e83a (patch) | |
tree | dd10d832315d0be30cb5a6afa4788038b9eba1d5 /src/test/com/jogamp/opengl | |
parent | 7ec812589190c0fbc6916cc22d9b74f009244f5c (diff) |
TileRenderer*: TileRendererNotify -> TileRendererListener w/ clarifying functionality (reshapeTile(..), ..); Only process GLEventListener impl. TileRendererListener; attachToAutoDrawable -> attachAutoDrawable, etc.
-TileRendererNotify -> TileRendererListener
- Added methods:
- void reshapeTile(TileRendererBase tr,int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight);
- void startTileRendering(TileRendererBase tr);
- void endTileRendering(TileRendererBase tr);
allowing to clarify user code and API specification,
i.e. TR only processes GLEventListener which impl. TileRendererListener.
This also allows simplifying the API doc, while having a more descriptive
reshape method focusing solely on tile rendering.
Further more, the start/end TR methods allow certain GL related actions
while the context is current before and after iterating through the tiles.
This is even used for RandomTileRenderer (one tile only), to allow
to reuse same TileRendererListener for diff TRs.
- Fix language, attach and detach usage was vice versa. We do attach an GLAutoDrawable to a TR
- attachToAutoDrawable -> attachAutoDrawable
- detachFromAutoDrawable -> detachAutoDrawable
- Adapted unit tests.
Diffstat (limited to 'src/test/com/jogamp/opengl')
7 files changed, 149 insertions, 100 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java index 05332c614..811e91886 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java @@ -1,7 +1,9 @@ package com.jogamp.opengl.test.junit.jogl.demos.es1; import com.jogamp.common.nio.Buffers; + import java.nio.*; + import javax.media.opengl.*; import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.fixedfunc.GLPointerFunc; @@ -10,7 +12,7 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.util.TileRendererBase; import com.jogamp.opengl.util.glsl.fixedfunc.*; -public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRendererNotify { +public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRendererListener { public static boolean oneThread = false; public static boolean useAnimator = false; @@ -37,15 +39,26 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES1.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES1.endTileRendering: "+tr); + } + public void setDoRotation(boolean rotate) { this.doRotate = rotate; } public void setForceFFPEmu(boolean forceFFPEmu, boolean verboseFFPEmu, boolean debugFFPEmu, boolean traceFFPEmu) { this.forceFFPEmu = forceFFPEmu; @@ -64,6 +77,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende private FloatBuffer colors; private FloatBuffer vertices; + @Override public void init(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" RedSquareES1.init ..."); GL _gl = drawable.getGL(); @@ -122,33 +136,31 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES1.init FIN"); } + @Override public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { - System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(glad.getHandle())+", tileRendererInUse "+tileRendererInUse); - GL2ES1 gl = glad.getGL().getGL2ES1(); - gl.setSwapInterval(swapInterval); + final GL2ES1 gl = glad.getGL().getGL2ES1(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2ES1 gl = tr.getAttachedDrawable().getGL().getGL2ES1(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2ES1 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + System.err.println(Thread.currentThread()+" RedSquareES1.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); // Set location in front of camera gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - if(-1 != swapInterval) { - gl.setSwapInterval(swapInterval); - } - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } // compute projection parameters 'normal' perspective final float fovy=45f; final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect; @@ -174,6 +186,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES1.reshape FIN"); } + @Override public void display(GLAutoDrawable drawable) { curTime = System.currentTimeMillis(); GL2ES1 gl = drawable.getGL().getGL2ES1(); @@ -202,6 +215,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende gl.glDisableClientState(GLPointerFunc.GL_COLOR_ARRAY); } + @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" RedSquareES1.dispose ... "); GL2ES1 gl = drawable.getGL().getGL2ES1(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index 273d5c4e9..bea761a35 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -34,6 +34,7 @@ import com.jogamp.opengl.util.TileRendererBase; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; + import java.nio.FloatBuffer; import javax.media.nativewindow.NativeWindow; @@ -49,7 +50,7 @@ import javax.media.opengl.GLUniformData; * GearsES2.java <BR> * @author Brian Paul (converted to Java by Ron Cemer and Sven Gothel) <P> */ -public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererNotify { +public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererListener { private final FloatBuffer lightPos = Buffers.newDirectFloatBuffer( new float[] { 5.0f, 5.0f, 10.0f } ); private ShaderState st = null; @@ -84,15 +85,25 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("GearsES2.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("GearsES2.endTileRendering: "+tr); + } public void setIgnoreFocus(boolean v) { ignoreFocus = v; } public void setDoRotation(boolean rotate) { this.doRotate = rotate; } @@ -136,6 +147,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN public GearsObjectES2 getGear3() { return gear3; } + @Override public void init(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES2.init: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = drawable.getGL().getGL2ES2(); @@ -233,18 +245,29 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN System.err.println(Thread.currentThread()+" GearsES2.init FIN"); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - final GL2ES2 gl = drawable.getGL().getGL2ES2(); + @Override + public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + final GL2ES2 gl = glad.getGL().getGL2ES2(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); - System.err.println(Thread.currentThread()+" GearsES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); - - drawableHeight = height; + System.err.println(Thread.currentThread()+" GearsES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); + drawableHeight = imageHeight; - // Thread.dumpStack(); - - if(-1 != swapInterval) { - gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there) - } if( !gl.hasGLSL() ) { return; } @@ -253,23 +276,6 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - gl.setSwapInterval(swapInterval); - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } - // compute projection parameters 'normal' float left, right, bottom, top; if( imageHeight > imageWidth ) { @@ -312,6 +318,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN } // private boolean useAndroidDebug = false; + @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" GearsES2.dispose: tileRendererInUse "+tileRendererInUse); final Object upstreamWidget = drawable.getUpstreamWidget(); @@ -339,6 +346,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererN System.err.println(Thread.currentThread()+" GearsES2.dispose FIN"); } + @Override public void display(GLAutoDrawable drawable) { GLAnimatorControl anim = drawable.getAnimator(); if( verbose && ( null == anim || !anim.isAnimating() ) ) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java index 40e9876ea..715a97d63 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java @@ -34,13 +34,14 @@ import com.jogamp.opengl.util.TileRendererBase; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; import com.jogamp.opengl.util.glsl.ShaderState; + import javax.media.opengl.GL; import javax.media.opengl.GL2ES2; import javax.media.opengl.GLAutoDrawable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLUniformData; -public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererNotify { +public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRendererListener { private ShaderState st; private PMVMatrix pmvMatrix; private GLUniformData pmvMatrixUniform; @@ -62,19 +63,31 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES2.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("RedSquareES2.endTileRendering: "+tr); + } + public void setAspect(float aspect) { this.aspect = aspect; } public void setDoRotation(boolean rotate) { this.doRotate = rotate; } public void setClearBuffers(boolean v) { clearBuffers = v; } + @Override public void init(GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); @@ -138,6 +151,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES2.init FIN"); } + @Override public void display(GLAutoDrawable glad) { long t1 = System.currentTimeMillis(); @@ -174,10 +188,27 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende st.useProgram(gl, false); } + @Override public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { - System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+x+"/"+y+" "+width+"x"+height+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(glad.getHandle())+", tileRendererInUse "+tileRendererInUse); - // Thread.dumpStack(); final GL2ES2 gl = glad.getGL().getGL2ES2(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2ES2 gl = tr.getAttachedDrawable().getGL().getGL2ES2(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2ES2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { + System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse); + // Thread.dumpStack(); if( !gl.hasGLSL() ) { return; } @@ -187,24 +218,6 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - if(-1 != swapInterval) { - gl.setSwapInterval(swapInterval); - } - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } // compute projection parameters 'normal' perspective final float fovy=45f; final float aspect2 = ( (float) imageWidth / (float) imageHeight ) / aspect; @@ -233,6 +246,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende System.err.println(Thread.currentThread()+" RedSquareES2.reshape FIN"); } + @Override public void dispose(GLAutoDrawable glad) { System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse); final GL2ES2 gl = glad.getGL().getGL2ES2(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java index 110dfb779..74089c2fd 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java @@ -26,7 +26,7 @@ import com.jogamp.opengl.util.TileRendererBase; * * This version is equal to Brian Paul's version 1.2 1999/10/21 */ -public class Gears implements GLEventListener, TileRendererBase.TileRendererNotify { +public class Gears implements GLEventListener, TileRendererBase.TileRendererListener { private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f; private int gear1=0, gear2=0, gear3=0; private float angle = 0.0f; @@ -49,15 +49,25 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti this.swapInterval = 1; } + @Override public void addTileRendererNotify(TileRendererBase tr) { tileRendererInUse = tr; doRotateBeforePrinting = doRotate; setDoRotation(false); } + @Override public void removeTileRendererNotify(TileRendererBase tr) { tileRendererInUse = null; setDoRotation(doRotateBeforePrinting); } + @Override + public void startTileRendering(TileRendererBase tr) { + System.err.println("Gears.startTileRendering: "+tr); + } + @Override + public void endTileRendering(TileRendererBase tr) { + System.err.println("Gears.endTileRendering: "+tr); + } public void setDoRotation(boolean rotate) { doRotate = rotate; } public void setVerbose(boolean v) { verbose = v; } @@ -83,6 +93,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti */ public int getGear3() { return gear3; } + @Override public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); @@ -154,14 +165,31 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti gl.glEnable(GL2.GL_NORMALIZE); } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { - GL2 gl = drawable.getGL().getGL2(); - this.reshape(gl, x, y, width, height); + @Override + public void reshape(GLAutoDrawable glad, int x, int y, int width, int height) { + final GL2 gl = glad.getGL().getGL2(); + if(-1 != swapInterval) { + gl.setSwapInterval(swapInterval); + } + reshapeImpl(gl, x, y, width, height, width, height); } - + public void reshape(GL2 gl, int x, int y, int width, int height) { + reshapeImpl(gl, x, y, width, height, width, height); + } + + @Override + public void reshapeTile(TileRendererBase tr, + int tileX, int tileY, int tileWidth, int tileHeight, + int imageWidth, int imageHeight) { + final GL2 gl = tr.getAttachedDrawable().getGL().getGL2(); + gl.setSwapInterval(0); + reshapeImpl(gl, tileX, tileY, tileWidth, tileHeight, imageWidth, imageHeight); + } + + void reshapeImpl(GL2 gl, int tileX, int tileY, int tileWidth, int tileHeight, int imageWidth, int imageHeight) { final boolean msaa = gl.getContext().getGLDrawable().getChosenGLCapabilities().getSampleBuffers(); - System.err.println("Gears: Reshape "+x+"/"+y+" "+width+"x"+height+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); + System.err.println(Thread.currentThread()+" Gears.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", msaa "+msaa+", tileRendererInUse "+tileRendererInUse); if( msaa ) { gl.glEnable(GL.GL_MULTISAMPLE); @@ -171,23 +199,6 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti gl.glLoadIdentity(); - final int tileWidth = width; - final int tileHeight = height; - final int tileX, tileY, imageWidth, imageHeight; - if( null == tileRendererInUse ) { - gl.setSwapInterval(swapInterval); - tileX = 0; - tileY = 0; - imageWidth = width; - imageHeight = height; - } else { - gl.setSwapInterval(0); - tileX = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_X_POS); - tileY = tileRendererInUse.getParam(TileRendererBase.TR_CURRENT_TILE_Y_POS); - imageWidth = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_WIDTH); - imageHeight = tileRendererInUse.getParam(TileRendererBase.TR_IMAGE_HEIGHT); - } - // compute projection parameters 'normal' float left, right, bottom, top; if( imageHeight > imageWidth ) { @@ -228,6 +239,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti } } + @Override public void dispose(GLAutoDrawable drawable) { System.err.println(Thread.currentThread()+" Gears.dispose: tileRendererInUse "+tileRendererInUse); try { @@ -241,6 +253,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererNoti setGears(0, 0, 0); } + @Override public void display(GLAutoDrawable drawable) { // Get the GL corresponding to the drawable we are animating GL2 gl = drawable.getGL().getGL2(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java index 09817a27f..d539b5e55 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java @@ -107,7 +107,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { // Initialize the tile rendering library final RandomTileRenderer renderer = new RandomTileRenderer(); - renderer.attachToAutoDrawable(glad); + renderer.attachAutoDrawable(glad); renderer.setImageSize(imageWidth, imageHeight); final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; @@ -146,7 +146,7 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { } } - renderer.detachFromAutoDrawable(); + renderer.detachAutoDrawable(); // Restore viewport and Gear's PMV matrix // .. even though we close the demo, this is for documentation! 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 16f11d85b..7d3f1f622 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 @@ -196,7 +196,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { } catch (IOException e) { e.printStackTrace(); } - renderer.detachFromAutoDrawable(); + renderer.detachAutoDrawable(); 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()); @@ -224,7 +224,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { signalTileRenderer = false; // tile rendering ! System.err.println("XXX START TILE RENDERING"); - renderer.attachToAutoDrawable(glad); + renderer.attachAutoDrawable(glad); } Thread.sleep(100); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java index 26ac34d5a..f0819a43d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java @@ -188,7 +188,7 @@ public class TestTiledRendering2NEWT extends UITestCase { final TileRenderer renderer = new TileRenderer(); renderer.setImageSize(imageWidth, imageHeight); renderer.setTileSize(glad.getWidth(), glad.getHeight(), 0); - renderer.attachToAutoDrawable(glad); + renderer.attachAutoDrawable(glad); final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; final boolean[] flipVertically = { false }; @@ -219,7 +219,7 @@ public class TestTiledRendering2NEWT extends UITestCase { renderer.display(); } while ( !renderer.eot() ); - renderer.detachFromAutoDrawable(); + renderer.detachAutoDrawable(); // Restore viewport and Gear's PMV matrix // .. even though we close the demo, this is for documentation! |