We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › z-axis distortion
Page Index Toggle Pages: 1
z-axis distortion (Read 291 times)
z-axis distortion
Apr 17th, 2008, 11:45am
 
Hi all!

I've just played a little bit with a moving camera, but I'm not really happy with the perspective. I've tried changing it with perspective(p1, p2, etc) but I'm not really getting it. I hope someone can explain. The problem is that the box (see code below) is stretched too much along the z-axis.

import processing.opengl.*;

int pan;

void setup() {
 size(600, 300, OPENGL);
}

void draw() {
 background(127);
 pan = (pan + 1) % 600;
 camera(pan, height/2, (height/2.0) / tan(PI*60.0 / 360.0), pan, height/2, 0, 0, 1, 0);
 translate(width/2, height/2, 0);
 strokeWeight(2);
 box(50);
}

Thanks in advance,

.ben
Page Index Toggle Pages: 1