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 & HelpOpenGL and 3D Libraries › Change position of axis of a box
Page Index Toggle Pages: 1
Change position of axis of a box (Read 585 times)
Change position of axis of a box
Feb 19th, 2009, 2:48pm
 
I am creating several boxes, but instead of having the axis of the box in the center, I want it to lie in the middle of one of the surfaces of the box.

Is this possible, and if so, how?

Thanks in advance!
Re: Change position of axis of a box
Reply #1 - Feb 21st, 2009, 7:22pm
 
I'm not sure what your question means. Do you mean that you wish to animate the rotation of the box around an axis that lies on one of the cube's surfaces?

In general you'll need to learn how to use the translate() and rotate() functions to transform the coordinate space before drawing. The reference has some sample code for that kind of thing.
Re: Change position of axis of a box
Reply #2 - Feb 25th, 2009, 4:57pm
 
No, that is not what I mean. I know how rotate() and translate() work.

Let me try to explain in better:
When a box is created in OPENGL (with box(...)) the center is the 'base-point': when rotate() or translate() is performed, it is done around this point.
But I want this point to lie on a surface (in this case the bottom), so that when I for instance translate, it is done according to the surface, instead of the center of the box...

More clear?
Page Index Toggle Pages: 1