I draw 3d lines using line(x,y,z,x2,y2,z2) creating a sceen over the course of a few minutes and then I would like to rotate the entire sceen to see it from the side. Is it possible to do this without requiring recording all the possitions and redrawing them on each frame?
One idea: paint line()'s onto an image which is mapped over a vertex and then rotate this.
Problem: I wont be able to see the original 3d shape of the lines. Meaning: z is lost.
Does anyone have an idea of other solutions. Here is some example code that explains the problem. When run it paints onto a layer. When you press ',' it rotates Y and starts a new layer. My desire is that when you rotate it rotates the old layer with it, showing the z contours of the lines in accordance with the new rotation angle. (btw, '.' rotates back to the original plane)
Code:
import processing.opengl.*;
float angle = 0;
int x=10;
int y=10;
int z=0;
void setup () {
size(800,600,OPENGL);
hint(DISABLE_OPENGL_2X_SMOOTH);// opengl bug
background(0);
stroke(255);
}
void draw () {
rotateY(angle);
line(x,y,z, x+10,y,z+10);
x+=10;
y+=10;
if(x >= 800)
x = 10;
if(y >= 600)
y = 10;
}
void keyPressed() {
if (key == ',') {
angle = PI/3.0;
stroke(255,0,0);
}
else if (key == '.')
{
angle = 0;
stroke(255);
}
}