From e051c1325c7da1d5428251ef0d413b2bc7287e04 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 12 Dec 2011 05:03:51 +0000 Subject: [PATCH] Added two more examples: SmoothChange and Primitive --- .../Image/SmoothChange/SmoothChange.pde | 26 +++++++++++++++++++ .../examples/Retained/Primitive/Primitive.pde | 24 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 java/libraries/opengl/examples/Image/SmoothChange/SmoothChange.pde create mode 100644 java/libraries/opengl/examples/Retained/Primitive/Primitive.pde diff --git a/java/libraries/opengl/examples/Image/SmoothChange/SmoothChange.pde b/java/libraries/opengl/examples/Image/SmoothChange/SmoothChange.pde new file mode 100644 index 000000000..286adb1bf --- /dev/null +++ b/java/libraries/opengl/examples/Image/SmoothChange/SmoothChange.pde @@ -0,0 +1,26 @@ +PImage img; +int level = 2; + +public void setup() { + size(200, 200, P3D); + frameRate(90); + smooth(level); + + img = loadImage("milan_rubbish.jpg"); +} + +public void draw () { + background(0); + + tint(255, 150); + image(img, 0, 0, width, height); + + fill(255); + text("current smooth: " + level, mouseX, mouseY); +} + +void keyPressed() { + level = 4; + smooth(level); +} + diff --git a/java/libraries/opengl/examples/Retained/Primitive/Primitive.pde b/java/libraries/opengl/examples/Retained/Primitive/Primitive.pde new file mode 100644 index 000000000..6d94fafda --- /dev/null +++ b/java/libraries/opengl/examples/Retained/Primitive/Primitive.pde @@ -0,0 +1,24 @@ +PShape3D circle; + +public void setup() { + size(400, 400, P3D); + frameRate(90); + + fill(255, 0, 0); + stroke(0, 0, 255); + strokeWeight(3); + circle = (PShape3D) createShape(ELLIPSE, 0, 0, 100, 100); +} + +public void draw () { + background(0); + + if (5000 < millis()) { + circle.fill(map(mouseX, 0, width, 255, 0), 0, 0); + circle.stroke(0, 0, map(mouseY, 0, height, 255, 0)); + } + + + translate(mouseX, mouseY); + shape(circle); +}