From 2d5f1650af2b64f7a8d25842b2b95192b3e4a4e9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 16 Oct 2009 02:40:31 -0700 Subject: Tweak read buffer demo --- src/demos/readbuffer/Main.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/demos/readbuffer/Main.java b/src/demos/readbuffer/Main.java index ea24efa..e5d87a9 100755 --- a/src/demos/readbuffer/Main.java +++ b/src/demos/readbuffer/Main.java @@ -54,10 +54,10 @@ public class Main implements WindowListener, MouseListener, SurfaceUpdatedListen public void mouseWheelMoved(MouseEvent e) { } - public GLWindow createOffscreen(GLCapabilities caps, int w, int h) { + public GLWindow createOffscreen(GLCapabilities caps, int w, int h, boolean pbuffer) { GLCapabilities capsOffscreen = (GLCapabilities) caps.clone(); capsOffscreen.setOnscreen(false); - capsOffscreen.setPBuffer(true); + capsOffscreen.setPBuffer(pbuffer); capsOffscreen.setDoubleBuffered(false); GLWindow windowOffscreen = GLWindow.create(capsOffscreen); windowOffscreen.enablePerfLog(true); @@ -66,7 +66,7 @@ public class Main implements WindowListener, MouseListener, SurfaceUpdatedListen return windowOffscreen; } - private void run(String glProfileStr, int typeNewt, boolean fullscreen, int typeTest, GLEventListener demo) { + private void run(String glProfileStr, int typeNewt, boolean fullscreen, int typeTest, GLEventListener demo, boolean pbuffer) { GLProfile glp = GLProfile.get(glProfileStr); int width = 800; int height = 480; @@ -75,7 +75,7 @@ public class Main implements WindowListener, MouseListener, SurfaceUpdatedListen GLCapabilities caps = new GLCapabilities(glp); // Full init pbuffer window .. - GLWindow windowOffscreen = createOffscreen(caps, width, height); + GLWindow windowOffscreen = createOffscreen(caps, width, height, pbuffer); // setField(demo, "glDebug", new Boolean(true)); // setField(demo, "glTrace", new Boolean(true)); if(!setField(demo, "window", windowOffscreen)) { @@ -150,6 +150,7 @@ public class Main implements WindowListener, MouseListener, SurfaceUpdatedListen public static void main(String[] args) { String glProfileStr = null; boolean fullscreen = false; + boolean pbuffer = true; int typeNewt = USE_NEWT ; int typeTest = TEST_SURFACE2FILE; int i=0; @@ -158,6 +159,8 @@ public class Main implements WindowListener, MouseListener, SurfaceUpdatedListen typeNewt |= USE_AWT; } else if(args[i].equals("-fs")) { fullscreen = true; + } else if(args[i].equals("-nopbuffer")) { + pbuffer = false; } else if(args[i].equals("-test")) { i++; typeTest = str2int(args[i], typeTest); @@ -181,7 +184,7 @@ public class Main implements WindowListener, MouseListener, SurfaceUpdatedListen } GLEventListener demo = (GLEventListener) demoObject; - new Main().run(glProfileStr, typeNewt, fullscreen, typeTest, demo); + new Main().run(glProfileStr, typeNewt, fullscreen, typeTest, demo, pbuffer); System.exit(0); } -- cgit v1.2.3