From f190078ad0d9e23ca521cf58bee0fb7c4824f34f Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 5 Sep 2004 08:38:53 +0000 Subject: [PATCH] Removed shared pcontext buffer tests and updated unique context tests --- .../test/opengl/pbuffers/PbufferTest.java | 14 +--- .../test/opengl/pbuffers/SharedRenderer.java | 74 ----------------- .../opengl/pbuffers/SharedRendererRTT.java | 79 ------------------- .../test/opengl/pbuffers/UniqueRenderer.java | 4 +- .../opengl/pbuffers/UniqueRendererRTT.java | 4 +- 5 files changed, 6 insertions(+), 169 deletions(-) delete mode 100644 src/java/org/lwjgl/test/opengl/pbuffers/SharedRenderer.java delete mode 100644 src/java/org/lwjgl/test/opengl/pbuffers/SharedRendererRTT.java diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java b/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java index 7696ff33..ebefba1f 100644 --- a/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java +++ b/src/java/org/lwjgl/test/opengl/pbuffers/PbufferTest.java @@ -129,14 +129,6 @@ public final class PbufferTest { System.out.print("Creating render-to-texture pbuffer with unique context..."); texRenderer = new UniqueRendererRTT(TEXTURE_SIZE, TEXTURE_SIZE, texID); break; - case 3: - System.out.print("Creating pbuffer with shared context..."); - texRenderer = new SharedRenderer(TEXTURE_SIZE, TEXTURE_SIZE, texID); - break; - case 4: - System.out.print("Creating render-to-texture pbuffer with shared context..."); - texRenderer = new SharedRendererRTT(TEXTURE_SIZE, TEXTURE_SIZE, texID); - break; } System.out.println("OK"); @@ -433,10 +425,8 @@ public final class PbufferTest { System.out.println("-------"); System.out.println("Usage: java org.lwjgl.test.opengl.pbuffer.PbufferTest "); System.out.println("\n\tA number in the range 1-4."); - System.out.println("\t1: Unique Context, no render-to-texture"); - System.out.println("\t2: Unique Context, with render-to-texture"); - System.out.println("\t3: Shared Context, no render-to-texture"); - System.out.println("\t4: Shared Context, with render-to-texture"); + System.out.println("\t1: no render-to-texture"); + System.out.println("\t2: with render-to-texture"); System.exit(-1); } diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/SharedRenderer.java b/src/java/org/lwjgl/test/opengl/pbuffers/SharedRenderer.java deleted file mode 100644 index 9b977a26..00000000 --- a/src/java/org/lwjgl/test/opengl/pbuffers/SharedRenderer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 THE COPYRIGHT OWNER 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. - */ -package org.lwjgl.test.opengl.pbuffers; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.Pbuffer; - -final class SharedRenderer extends TextureRenderer { - - SharedRenderer(final int width, final int height, final int texID) { - super(width, height, texID); - } - - protected Pbuffer init(final int width, final int height, final int texID) { - Pbuffer pbuffer = null; - - try { - pbuffer = Pbuffer.createPbufferUsingDisplayContext(width, height, null); - } catch (LWJGLException e) { - e.printStackTrace(); - System.exit(-1); - } - - return pbuffer; - } - - void enable() { - super.enable(); - - // Change the current state, since we're sharing the display context. - PbufferTest.initGLState(width, height, 0.5f); - GL11.glDisable(GL11.GL_TEXTURE_2D); - } - - public void updateTexture() { - // Copy the pbuffer contents to the texture. - GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, width, height, 0); - - // Restore the display state. - PbufferTest.initGLState(800, 600, 0.0f); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/SharedRendererRTT.java b/src/java/org/lwjgl/test/opengl/pbuffers/SharedRendererRTT.java deleted file mode 100644 index cf652b16..00000000 --- a/src/java/org/lwjgl/test/opengl/pbuffers/SharedRendererRTT.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2002-2004 LWJGL Project - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * 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. - * - * * Neither the name of 'LWJGL' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "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 THE COPYRIGHT OWNER 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. - */ -package org.lwjgl.test.opengl.pbuffers; - -import org.lwjgl.LWJGLException; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.Pbuffer; -import org.lwjgl.opengl.RenderTexture; - -final class SharedRendererRTT extends TextureRenderer { - - SharedRendererRTT(final int width, final int height, final int texID) { - super(width, height, texID); - } - - protected Pbuffer init(final int width, final int height, final int texID) { - Pbuffer pbuffer = null; - - try { - final RenderTexture rt = new RenderTexture(true, false, false, false, RenderTexture.RENDER_TEXTURE_2D, 0); - pbuffer = Pbuffer.createPbufferUsingDisplayContext(width, height, rt); - } catch (LWJGLException e) { - e.printStackTrace(); - System.exit(-1); - } - - return pbuffer; - } - - void enable() { - super.enable(); - - // Change the current state, since we're sharing the display context. - PbufferTest.initGLState(width, height, 0.5f); - GL11.glDisable(GL11.GL_TEXTURE_2D); - - // Release the texture before rendering. - pbuffer.releaseTexImage(Pbuffer.BACK_LEFT_BUFFER); - } - - void updateTexture() { - // Bind the texture after rendering. - pbuffer.bindTexImage(Pbuffer.BACK_LEFT_BUFFER); - - // Restore the display state. - PbufferTest.initGLState(800, 600, 0.0f); - GL11.glEnable(GL11.GL_TEXTURE_2D); - } - -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java index 2ec5c463..53838d29 100644 --- a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java +++ b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRenderer.java @@ -47,7 +47,7 @@ final class UniqueRenderer extends TextureRenderer { Pbuffer pbuffer = null; try { - pbuffer = Pbuffer.createPbufferUsingUniqueContext(width, height, new PixelFormat(16, 0, 0, 0, 0), null); + pbuffer = new Pbuffer(width, height, new PixelFormat(16, 0, 0, 0, 0), null); // Initialise state of the pbuffer context. pbuffer.makeCurrent(); @@ -69,4 +69,4 @@ final class UniqueRenderer extends TextureRenderer { GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, width, height, 0); } -} \ No newline at end of file +} diff --git a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java index a358dc67..f3e67c45 100644 --- a/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java +++ b/src/java/org/lwjgl/test/opengl/pbuffers/UniqueRendererRTT.java @@ -46,7 +46,7 @@ final class UniqueRendererRTT extends TextureRenderer { try { final RenderTexture rt = new RenderTexture(true, false, false, false, RenderTexture.RENDER_TEXTURE_2D, 0); - pbuffer = Pbuffer.createPbufferUsingUniqueContext(width, height, new PixelFormat(16, 0, 0, 0, 0), rt); + pbuffer = new Pbuffer(width, height, new PixelFormat(16, 0, 0, 0, 0), rt); // Initialise state of the pbuffer context. pbuffer.makeCurrent(); @@ -75,4 +75,4 @@ final class UniqueRendererRTT extends TextureRenderer { pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER); } -} \ No newline at end of file +}