Updated some examples

This commit is contained in:
codeanticode
2012-07-26 19:24:19 +00:00
parent 31a062041c
commit b63028d699
2 changed files with 19 additions and 21 deletions
@@ -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();
}
}
@@ -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();
}