moving the OpenGL examples to the core

This commit is contained in:
benfry
2012-07-20 20:24:58 +00:00
parent b30328bb66
commit 40ecd562e3
133 changed files with 0 additions and 0 deletions
@@ -0,0 +1,32 @@
PGraphics pg;
void setup() {
size(400, 400, P3D);
pg = createGraphics(400, 400, P3D);
pg.smooth(4);
}
void draw() {
background(0);
pg.beginDraw();
pg.background(255, 0, 0);
pg.ellipse(mouseX, mouseY, 100, 100);
pg.endDraw();
image(pg, 0, 0, 400, 400);
}
void keyPressed() {
if (key == '1') pg.smooth(1);
else if (key == '2') pg.smooth(2);
else if (key == '3') pg.smooth(4);
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();
}
}
@@ -0,0 +1,14 @@
void setup() {
size(400, 400, P3D);
noLoop();
}
void draw() {
background(255, 0, 0);
ellipse(mouseX, mouseY, 100, 50);
println("draw");
}
void keyPressed() {
redraw();
}
@@ -0,0 +1,10 @@
void setup() {
size(400, 400, P3D);
frame.setResizable(true);
}
void draw() {
background(255, 0, 0);
ellipse(width/2, height/2, 100, 50);
}
@@ -0,0 +1,25 @@
PShape cube;
public void setup() {
size(400, 400, P3D);
cube = createShape(BOX, 100);
}
public void draw() {
background(120);
lights();
translate(mouseX, mouseY);
rotateX(frameCount * 0.01f);
rotateY(frameCount * 0.01f);
shape(cube);
}
public void keyPressed() {
// Restarts the OpenGL surface. Automatically
// recreates all the current GL resources.
((PGraphicsOpenGL)g).restartPGL();
}
@@ -0,0 +1,19 @@
void setup() {
size(400, 400, P3D);
smooth(2);
}
void draw() {
background(255, 0, 0);
ellipse(mouseX, mouseY, 100, 100);
}
void keyPressed() {
if (key == '1') smooth(1);
else if (key == '2') smooth(2);
else if (key == '3') smooth(4);
else if (key == '4') smooth(8);
else if (key == '5') smooth(16);
else if (key == '6') smooth(32);
}