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 › Registration point (translate) w/ beginShape()
Page Index Toggle Pages: 1
Registration point (translate?) w/ beginShape() (Read 440 times)
Registration point (translate?) w/ beginShape()
Dec 22nd, 2008, 10:06pm
 
I come from a Flash AS3 and PV3D background, so please excuse my lack of correct jargon.

I'm playing around with the SpaceJunk OpenGL example. When each cube is created it is building the cube off center to position the cube. So, when you rotate the cube it rotates the cube according to a point that is the center of the view.

I would like to rotate the cube on it's own axis. I am thinking i need to move the registration point or something. Can someone point me in the right direction?

Thanks!
Re: Registration point (translate?) w/ beginShape(
Reply #1 - Dec 27th, 2008, 8:02pm
 
hi.
the registration point is allways the (0,0,0)
so for example if you want to rotate a shape around its own axis you need to draw it centered at (0,0,0), translate it to the desired position and then rotate the shape.
here's some pseudo code

Code:

pushMatrix();
translate(positionX, positionY, positionZ);
rotateX(rotX);
rotateY(rotY);
rotateZ(rotZ);
beginShape(POLYGON);
//draw shape centered at (0,0,0)
endShape();
popMatrix();


hope that helps Smiley
Re: Registration point (translate?) w/ beginShape(
Reply #2 - Jan 6th, 2009, 1:09am
 
Thanks very much! That helped.
Page Index Toggle Pages: 1