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.
Page Index Toggle Pages: 1
Reseting perspective() on resize (Read 2785 times)
Reseting perspective() on resize
May 2nd, 2005, 11:35pm
 
Hi ben,

before anything, great commenting and documenting of the PGraphics3 code!!!

and after that, I had a small question about resizing the applet.  It says in the code that the projection matrix goes back to default.

Quote:
 /**
  * Calls perspective() with Processing's standard coordinate projection.
  * <P>
  * Projection functions:
  * <UL>
  * <LI>frustrum()
  * <LI>ortho()
  * <LI>perspective()
  * </UL>
  * Each of these three functions completely replaces the projection
  * matrix with a new one. They can be called inside setup(), and their
  * effects will be felt inside draw(). At the top of draw(), the projection
  * matrix is not reset. Therefore the last projection function to be
  * called always dominates. On resize, the default projection is always
  * established, which has perspective.

  * <P>
  * This behavior is pretty much familiar from OpenGL.
  * <P>
  */


(these questions aren't based on examples but on thoughts after looking at the code and doc)

-why we put it back to default projection?

-could we put back the last projection matrix with some scaling of axes and updating of aspect ratio, in order to get a resized version of what we were seeing?

-is there a way handle the resize event (resizeEvent() or something like that) to apply some wanted changes only at that moment (instead of applying them on each draw() dependning on the width and height)?

thanx a lot!!
Re: Reseting perspective() on resize
Reply #1 - May 3rd, 2005, 12:31am
 
nah, cuz it's too messy to try and remap coordinates after a resize(). the thinking is this: if you're not messing with the coordinate system, then you need resize() to just work.

if you *are* messing with the coordinate system, that would indicate that you know what you're doing and should write code to update things based on the way you're messing with the transform. we can't anticipate what people will do to the perspective transformation.

capturing a resize even would be done based on java's methods for handling the same situation with a Component.

you can also thank simon for the comments, cuz he wrote up a spec while he was fixing the camera stuff yesterday so that he could keep everything straight.
Re: Reseting perspective() on resize
Reply #2 - May 3rd, 2005, 11:58am
 
ah ok, I thought it would be simple to map a resizing to the projection matrix, I guess I am wrong, I will look into it to get a better understanding.

and of course thanks to simon for the commenting, and for the great work on the P3D lightning and camera goodies!!
Page Index Toggle Pages: 1