thank you again for the quick answer,
you're right: I have to clear my mind and freeze what I want to do.
Talking about freezing... there is a last thing (by now) I would like to ask: in "void draw()" when I set a background I can navigate in the space and the applet is always refreshed, but the images are continuously flashing.
Can you tell me how to solve the problem?
I hope this will be the last stupid question.
Starting from zero, in few days I learned a lot, and I like processing more and more.
Thank you.
the code is:
Quote:
import processing.opengl.*;
import damkjer.ocd.*;
Camera camera1;
PImage images[];
int numberOfImages = 4;
void setup() {
size(800, 600, P3D);
frameRate(50);
// little buggy camera constructor from OCD library
camera1 = new Camera(this,
200.0, 0.0, 500.0,
200.0, 50.0, -500.0,
0.0, 1.0, 0.0,
radians(PI/7), (width/height), 1.0, 1000.0);
camera1.zoom(radians(130) / 2.0);
images = new PImage[numberOfImages];
for ( int i=0; i < numberOfImages; i++ )
{
images[i] = loadImage("imageName"+i+".jpg");
// loades images 0-11:
// imageName0.jpg
// ...
// imageName11.jpg
}
}
int counter = 0;
void draw() {
background(255);
camera1.feed();
cameraNavigation();
{
pushMatrix() ;
translate(counter*100, 0 );
image(images[counter],0,0,100,100);
popMatrix();
counter++;
counter %= numberOfImages; // wrap around
}
}
void cameraNavigation() {
if (!mousePressed){
//
} else if (mouseButton == LEFT) {
camera1.circle(radians(mouseX - pmouseX) / -2.0);
camera1.arc(radians(mouseY - pmouseY) / -2.0);
} else if (mouseButton == RIGHT) {
camera1.zoom(radians(mouseY - pmouseY) / 2.0);
} else if (mouseButton == CENTER) {
camera1.look(radians(mouseX - pmouseX) / 6.0, radians(mouseY - pmouseY) / 2.0);
}
}