From b63028d69961544b2f1cda96a43987693659175d Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 26 Jul 2012 19:24:19 +0000 Subject: [PATCH] Updated some examples --- .../Tests/OffscreenTest/OffscreenTest.pde | 3 -- .../OpenGL/Tests/RestartTest/RestartTest.pde | 37 ++++++++++--------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/java/examples/OpenGL/Tests/OffscreenTest/OffscreenTest.pde b/java/examples/OpenGL/Tests/OffscreenTest/OffscreenTest.pde index 335bdeb1e..1c4a56e7e 100644 --- a/java/examples/OpenGL/Tests/OffscreenTest/OffscreenTest.pde +++ b/java/examples/OpenGL/Tests/OffscreenTest/OffscreenTest.pde @@ -25,8 +25,5 @@ void keyPressed() { else if (key == '4') pg.smooth(8); else if (key == '5') pg.smooth(16); else if (key == '6') pg.smooth(32); - else if (key == ' ') { - ((PGraphicsOpenGL)g).restartPGL(); - } } diff --git a/java/examples/OpenGL/Tests/RestartTest/RestartTest.pde b/java/examples/OpenGL/Tests/RestartTest/RestartTest.pde index 7244eeb8a..8d03730cd 100644 --- a/java/examples/OpenGL/Tests/RestartTest/RestartTest.pde +++ b/java/examples/OpenGL/Tests/RestartTest/RestartTest.pde @@ -1,25 +1,26 @@ - PShape cube; +PShape cube; - public void setup() { - size(400, 400, P3D); +void setup() { + size(400, 400, P3D); + smooth(); - cube = createShape(BOX, 100); - } + cube = createShape(BOX, 100); +} - public void draw() { - background(120); +void draw() { + background(120); - lights(); + lights(); - translate(mouseX, mouseY); - rotateX(frameCount * 0.01f); - rotateY(frameCount * 0.01f); + translate(mouseX, mouseY); + rotateX(frameCount * 0.01f); + rotateY(frameCount * 0.01f); - shape(cube); - } + shape(cube); +} - public void keyPressed() { - // Restarts the OpenGL surface. Automatically - // recreates all the current GL resources. - ((PGraphicsOpenGL)g).restartPGL(); - } +void keyPressed() { + // Changing the smooth configuration restarts the OpenGL surface. + // Automatically recreates all the current GL resources. + noSmooth(); +}