Files
processing4/java/examples/Topics/Shaders/DomeProjection/DomeProjection.pde
2014-03-31 10:43:07 -04:00

53 lines
932 B
Plaintext

/**
* DomeProjection
*
* This sketch uses use environmental mapping to render the output
* on a full spherical dome.
*
* Based on the FullDomeTemplate code from Christopher Warnow:
* https://github.com/mphasize/FullDome
*
*/
import java.nio.IntBuffer;
PShader cubemapShader;
PShape domeSphere;
IntBuffer fbo;
IntBuffer rbo;
IntBuffer envMapTextureID;
int envMapSize = 1024;
void setup() {
size(640, 640, P3D);
initCubeMap();
}
void draw() {
background(0);
drawCubeMap();
}
void drawScene() {
background(0);
stroke(255, 0, 0);
strokeWeight(2);
for (int i = -width; i < 2 * width; i += 50) {
line(i, -height, -100, i, 2 *height, -100);
}
for (int i = -height; i < 2 * height; i += 50) {
line(-width, i, -100, 2 * width, i, -100);
}
lights();
noStroke();
translate(mouseX, mouseY, 200);
rotateX(frameCount * 0.01);
rotateY(frameCount * 0.01);
box(100);
}