Removed shared pcontext buffer tests and updated unique context tests
This commit is contained in:
parent
fbf42c7326
commit
f190078ad0
|
@ -129,14 +129,6 @@ public final class PbufferTest {
|
||||||
System.out.print("Creating render-to-texture pbuffer with unique context...");
|
System.out.print("Creating render-to-texture pbuffer with unique context...");
|
||||||
texRenderer = new UniqueRendererRTT(TEXTURE_SIZE, TEXTURE_SIZE, texID);
|
texRenderer = new UniqueRendererRTT(TEXTURE_SIZE, TEXTURE_SIZE, texID);
|
||||||
break;
|
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");
|
System.out.println("OK");
|
||||||
|
@ -433,10 +425,8 @@ public final class PbufferTest {
|
||||||
System.out.println("-------");
|
System.out.println("-------");
|
||||||
System.out.println("Usage: java org.lwjgl.test.opengl.pbuffer.PbufferTest <mode>");
|
System.out.println("Usage: java org.lwjgl.test.opengl.pbuffer.PbufferTest <mode>");
|
||||||
System.out.println("\n<mode>\tA number in the range 1-4.");
|
System.out.println("\n<mode>\tA number in the range 1-4.");
|
||||||
System.out.println("\t1: Unique Context, no render-to-texture");
|
System.out.println("\t1: no render-to-texture");
|
||||||
System.out.println("\t2: Unique Context, with render-to-texture");
|
System.out.println("\t2: 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.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -47,7 +47,7 @@ final class UniqueRenderer extends TextureRenderer {
|
||||||
Pbuffer pbuffer = null;
|
Pbuffer pbuffer = null;
|
||||||
|
|
||||||
try {
|
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.
|
// Initialise state of the pbuffer context.
|
||||||
pbuffer.makeCurrent();
|
pbuffer.makeCurrent();
|
||||||
|
|
|
@ -46,7 +46,7 @@ final class UniqueRendererRTT extends TextureRenderer {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final RenderTexture rt = new RenderTexture(true, false, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
|
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.
|
// Initialise state of the pbuffer context.
|
||||||
pbuffer.makeCurrent();
|
pbuffer.makeCurrent();
|
||||||
|
|
Loading…
Reference in New Issue