My code starts with:
I have a 2D object wich I rotate with
And then I want a little spotlight that moves around the scene. Is that possible? I tried
But that didn`t worked. Any help would be great!
Thanks in advance :)
- import processing.opengl.*;
- float a;
- void setup() {
- size(500, 500, OPENGL);
- fill(#F6D81E);
- noStroke();
- }
I have a 2D object wich I rotate with
- void draw() {
- background(90);
- translate(width/2, height/2);
- rotateX(a);
- rotateY(a*5);
- rotateX(PI/5);
- rect(20, 20, 20, 20);
rect(20, 20, 20, 20);
And then I want a little spotlight that moves around the scene. Is that possible? I tried
Set the view transform Push the matrix stack Set the model transform to update the light’s position Set the light position //glLightfv(GL_LIGHT_POSITION,…) Pop the matrix stack Send down the scene or model geometry Swap buffers.
But that didn`t worked. Any help would be great!
Thanks in advance :)
1