zoom with a variable OPENGL

Hi, In a processing OPENGL sketch, is it possible to handle the zoom (generally done with scroll in/out) with a variable without scaling (scale();) the object it self?

I have a sketch that is running on a computer that is controlled through OSC by another sketch running on an android mobile, and I would like to handle the zoom from there. It seems easiest to do that with a variable if this is possible, otherwise other solutions are also welcome.

I am pretty new to processing and would be very thankful for help.


  • forgot to say. I am using peasycam.

  • edited February 2015

    you can just use a variable with scale()

    are we talking 3D here?

    you can move the camera in minus z-axis

  • I think you can change the viewing distance with PeasyCam, shorter distance greater zoom.

  • @Chrisis

    yes, 3D.

    the problem with using the scale() is that it scales differently than moving the camera. I have solved it at the moment with moving the objects in the z-axis according to a variable with translate(), but as I plan to have multiple objects it seems more practical to move the camera instead of all the objects. can I use translate() on the camera? in that case how?

    I have only found the controls for the max/min: cam.setMinimumDistance(200); cam.setMaximumDistance(2000);

    but not the control for the actual camera position.


  • http://mrfeinberg.com/peasycam/

    you probably just want camera.setDistance(double d); // distance from looked-at point

Sign In or Register to comment.