OPENGL Shadows
in
Core Library Questions
•
1 years ago
Does anyone know of a simple example where OPENGL creates real-time shadows?
I know this is possible, but I have no idea how to implement it.
Here is a good starting point:
- import processing.opengl.*;
- void setup() {
- size(400, 400, OPENGL);
- camera(300, 300, 150, 100, 100, 50, 1, 1, 0);
- smooth();
- noStroke();
- }
- void draw() {
- rotateZ(frameCount/30.5);
- background(0);
- directionalLight(255, 255, 255, 0, -200, -100);
- fill(255);
- rect(-150, -150, 300, 300);
- sphere(50);
- //imitation shadow
- fill(10,100); translate(0,0,1); ellipse(0,-25,100,120); translate(0,0,-1);
- }
1