oompa_l
Full Member
Offline
Posts: 212
problem with the Integrator class from VD, by Fry
Oct 5th , 2008, 6:09am
Hi I have a sepcific program in mind that I haven trying to implement the Integrator class into - I would like a zooming type of function similar to the example with the zip codes in chapter 6. Mine, I believe, should be much simpler - I am thinking of using an object's position to drive the camera in 3d space...I just want to "integrate" or transition smoothly between the camera's current position and its target. I have tried it using my sketch and it hasn't worked. I proceeded to try and build a really dumb sketch using Integrator and figure out where I was going wrong but it hasn't helped. There seems to be something wrong with the targets... import processing.opengl.*; int H = 600; int W = 1000; Integrator cameraX, cameraY; PFont font; void setup() { size(W,H, OPENGL); hint(ENABLE_ACCURATE_TEXTURES); frameRate(20); camera(); font = loadFont("Swiss721BT-Light-12.vlw"); textFont(font, 12); Integrator cameraX = new Integrator(W/2); Integrator cameraY = new Integrator(H/2); } void draw() { background(0); //cameraX.update(); //cameraY.update(); rect(30, 20, 55, 55); rect(500, 500, 25, 25); } void mousePressed() { if ((mouseX > 30) && (mouseX <85) && (mouseY > 20) && (mouseY<75)){ cameraX.target(56); cameraY.target(46); setCamera(); } } void setCamera(){ camera(cameraX.value, cameraY.value, 100, cameraX.value, cameraY.value, 0, 0, 1, 0); cameraX.update(); cameraY.update(); } and the applet: oh wait...i just took a look at it and the export option doesnt seem to be working...any advice on that would be a great help too. I have tried others and I'm getting a viewport that doesnt match my sketch and nothing inside...