diff options
author | Sven Gothel <[email protected]> | 2012-02-25 13:57:48 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-02-25 13:57:48 +0100 |
commit | 1c8f158c57a13274e3776d3ecb24cbd1c9765741 (patch) | |
tree | f9688983c920aef64827fb5b0346329b1d8f3cf6 /src/test | |
parent | 49114a63102c745b3db204315ad9525d61767d57 (diff) |
Min. Graph Parameter type change: texSize/width/.. for multipass-renderer: int -> int[]
"texWidth desired texture width for multipass-rendering.
The actual used texture-width is written back when mp rendering is enabled, otherwise the store is untouched."
This allows the 'backend' to correct the texSize, ie in regards to GL_MAX_TEXTURE_SIZE .. etc.
Without this write-back, it would re-create the FBO for every frame.
Diffstat (limited to 'src/test')
8 files changed, 24 insertions, 27 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java index b6c3cc7fe..6db500ae8 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestRegionRendererNEWT01.java @@ -2,7 +2,6 @@ package com.jogamp.opengl.test.junit.graph; import java.io.IOException;
-import javax.media.nativewindow.NativeWindowFactory;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLCapabilitiesImmutable;
@@ -11,7 +10,6 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile;
import org.junit.Assert;
-import org.junit.BeforeClass;
import org.junit.Test;
import com.jogamp.graph.curve.Region;
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index 46085b179..668cdc607 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -80,7 +80,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { private float yTran = 10; private float ang = 0f; private float zoom = -70f; - private int texSize = 400; + private int[] texSize = new int[] { 400 }; protected volatile float weight = 1.0f; boolean ignoreInput = false; @@ -99,7 +99,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public final float getXTran() { return xTran; } public final float getYTran() { return yTran; } public final float getAngle() { return ang; } - public final int getTexSize() { return texSize; } + public final int[] getTexSize() { return texSize; } public final float[] getPosition() { return position; } public void setMatrix(float xtrans, float ytrans, float angle, int zoom, int fbosize) { @@ -107,7 +107,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { this.yTran = ytrans; this.ang = angle; this.zoom = zoom; - this.texSize = fbosize; + this.texSize[0] = fbosize; } public void init(GLAutoDrawable drawable) { @@ -191,7 +191,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public void printScreen(GLAutoDrawable drawable, String dir, String tech, String objName, boolean exportAlpha) throws GLException, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); - pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), texSize, objName); + pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), texSize[0], objName); final String filename = dir + tech + sw +".tga"; if(screenshot.readPixels(drawable.getGL(), drawable, false)) { @@ -233,12 +233,12 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { move(-1, 0); } else if(arg0.getKeyCode() == KeyEvent.VK_6){ - texSize -= 10; - System.err.println("Tex Size: " + texSize); + texSize[0] -= 10; + System.err.println("Tex Size: " + texSize[0]); } else if(arg0.getKeyCode() == KeyEvent.VK_7){ - texSize += 10; - System.err.println("Tex Size: " + texSize); + texSize[0] += 10; + System.err.println("Tex Size: " + texSize[0]); } else if(arg0.getKeyCode() == KeyEvent.VK_0){ rotate(1); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index c0d7f00e9..f066f0b84 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -31,9 +31,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { private boolean trace = false; private final int renderModes; - private final int texSize; + private final int[] texSize = new int[1]; private final int renderModes2; - private final int texSize2; + private final int[] texSize2 = new int[1]; private RegionRenderer regionRenderer; private RenderState rs; @@ -77,9 +77,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { public GPUUISceneGLListener0A(RenderState rs, int renderModes, boolean debug, boolean trace) { this.rs = rs; this.renderModes = renderModes; - this.texSize = Region.isVBAA(renderModes) ? 400 : 0; + this.texSize[0] = Region.isVBAA(renderModes) ? 400 : 0; this.renderModes2 = 0; - this.texSize2 = 0; + this.texSize2[0] = 0; this.debug = debug; this.trace = trace; @@ -301,7 +301,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { regionRenderer.scale(gl, 1.5f, 1.5f, 1.0f); regionRenderer.rotate(gl, angText , 0, 1, 0); regionRenderer.setColorStatic(gl, 0.0f, 1.0f, 0.0f); - regionRenderer.draw(gl, jogampRegion.getRegion(gl, rs, 0), new float[]{0,0,0}, 0); + regionRenderer.draw(gl, jogampRegion.getRegion(gl, rs, 0), new float[]{0,0,0}, null); if(null == labelRegions[currentText]) { if( null == labels[currentText]) { @@ -345,7 +345,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { if(showFPS && null != fpsRegion) { regionRenderer.translate(gl, 0, -60, 0); regionRenderer.scale(null, zoomText, zoomText, 1); - regionRenderer.draw(gl, fpsRegion.getRegion(gl, rs, 0), new float[]{0,0,0}, 0); + regionRenderer.draw(gl, fpsRegion.getRegion(gl, rs, 0), new float[]{0,0,0}, null); } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java index ca70481d7..4fef2d8c2 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/Label.java @@ -100,7 +100,6 @@ public abstract class Label extends UIShape implements UITextShape { @Override public void render(GL2ES2 gl, RenderState rs, RegionRenderer renderer, - int renderModes, int texSize, boolean selection) { - + int renderModes, int[/*1*/] texSize, boolean selection) { } } diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java index 3acab3bdb..bf403900d 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/RIButton.java @@ -199,7 +199,7 @@ public abstract class RIButton extends UIShape { private boolean toggle =false; private boolean toggleable = false; - public void render(GL2ES2 gl, RenderState rs, RegionRenderer renderer, int renderModes, int texSize, boolean selection) { + public void render(GL2ES2 gl, RenderState rs, RegionRenderer renderer, int renderModes, int[/*1*/] texSize, boolean selection) { if(null == buttonRegion) { buttonRegion = new UIRegion(this); labelRegion = new UIRegion(getLabel()); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java index 6a400e95f..c6d43480a 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/SceneUIController.java @@ -23,7 +23,7 @@ public class SceneUIController implements GLEventListener{ private int count = 0; private int renderModes; - private int texSize; + private int[] texSize; private RegionRenderer renderer = null; private RenderState rs = null; @@ -42,14 +42,14 @@ public class SceneUIController implements GLEventListener{ public SceneUIController() { } - public void setRenderer(RegionRenderer renderer, RenderState rs, int renderModes, int texSize) { + public void setRenderer(RegionRenderer renderer, RenderState rs, int renderModes, int[] texSize) { this.renderer = renderer; this.rs = rs; this.renderModes = renderModes; this.texSize = texSize; } - public SceneUIController(RegionRenderer renderer, RenderState rs, int renderModes, int texSize) { + public SceneUIController(RegionRenderer renderer, RenderState rs, int renderModes, int[] texSize) { this.renderer = renderer; this.rs = rs; this.renderModes = renderModes; @@ -136,7 +136,7 @@ public class SceneUIController implements GLEventListener{ gl.glClearColor(sceneClearColor[0], sceneClearColor[1], sceneClearColor[2], sceneClearColor[3]); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); - render(gl, width, height, 0, 0, true); + render(gl, width, height, 0, null, true); ByteBuffer pixel = Buffers.newDirectByteBuffer(4); pixel.order(ByteOrder.nativeOrder()); IntBuffer viewport = IntBuffer.allocate(4); @@ -151,7 +151,7 @@ public class SceneUIController implements GLEventListener{ return index; } - private void render(GL2ES2 gl, int width, int height, int renderModes, int texSize, boolean select) { + private void render(GL2ES2 gl, int width, int height, int renderModes, int[/*1*/] texSize, boolean select) { renderer.reshapePerspective(null, 45.0f, width, height, 0.1f, 7000.0f); for(int index=0; index < count;index++){ diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java index 4da5cac10..da94f6a7c 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIGLListener01.java @@ -109,10 +109,10 @@ public class UIGLListener01 extends UIListenerBase01 { } regionRenderer.setColorStatic(gl, bColor[0], bColor[1], bColor[2]); - regionRenderer.draw(gl, regionButton.getRegion(gl, rs, 0), getPosition(), 0); + regionRenderer.draw(gl, regionButton.getRegion(gl, rs, 0), getPosition(), null); // regionRenderer.translate(gl, button.getPosition()[0], button.getPosition()[1], button.getPosition()[2]); regionRenderer.setColorStatic(gl, lColor[0], lColor[1], lColor[2]); - regionRenderer.draw(gl, regionLabel.getRegion(gl, rs, 0), getPosition(), 0); + regionRenderer.draw(gl, regionLabel.getRegion(gl, rs, 0), getPosition(), null); } public void dispose(GLAutoDrawable drawable) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java index c04fa8b60..2f87fab66 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIShape.java @@ -55,7 +55,7 @@ public abstract class UIShape { shape.clear(); } - public abstract void render(GL2ES2 gl, RenderState rs, RegionRenderer renderer, int renderModes, int texSize, boolean selection); + public abstract void render(GL2ES2 gl, RenderState rs, RegionRenderer renderer, int renderModes, int[/*1*/] texSize, boolean selection); protected boolean positionDirty = false; |