mirror of
https://github.com/processing/processing4.git
synced 2026-01-30 11:51:54 +01:00
moving the OpenGL examples to the core
This commit is contained in:
30
java/examples/OpenGL/Pixels/GetPixels/GetPixels.pde
Normal file
30
java/examples/OpenGL/Pixels/GetPixels/GetPixels.pde
Normal file
@@ -0,0 +1,30 @@
|
||||
void setup() {
|
||||
size(255, 255, P3D);
|
||||
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// int c = color(x, y, 0);
|
||||
// set(x, y, c);
|
||||
// }
|
||||
// }
|
||||
|
||||
loadPixels();
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
int x = i % width;
|
||||
int y = i / height;
|
||||
int c = color(x, y, 0);
|
||||
set(x, y, c);
|
||||
}
|
||||
updatePixels();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
int c = get(x, y);
|
||||
set(x, y, c);
|
||||
}
|
||||
}
|
||||
|
||||
println(frameRate);
|
||||
}
|
||||
16
java/examples/OpenGL/Pixels/SetPixels/SetPixels.pde
Normal file
16
java/examples/OpenGL/Pixels/SetPixels/SetPixels.pde
Normal file
@@ -0,0 +1,16 @@
|
||||
void setup() {
|
||||
size(400, 400, P3D);
|
||||
|
||||
background(0);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
for (int x = 0; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
int c = color(random(255), random(255), random(255));
|
||||
set(x, y, c);
|
||||
}
|
||||
}
|
||||
|
||||
println(frameRate);
|
||||
}
|
||||
15
java/examples/OpenGL/Pixels/UpdatePixels/UpdatePixels.pde
Normal file
15
java/examples/OpenGL/Pixels/UpdatePixels/UpdatePixels.pde
Normal file
@@ -0,0 +1,15 @@
|
||||
void setup() {
|
||||
size(400, 400, P3D);
|
||||
|
||||
background(0);
|
||||
loadPixels();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
for (int i = 0; i < pixels.length; i++) {
|
||||
pixels[i] = color(random(255), random(255), random(255));
|
||||
}
|
||||
updatePixels();
|
||||
|
||||
println(frameRate);
|
||||
}
|
||||
Reference in New Issue
Block a user