Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > OpenGL 3D API > Re: centr of ro...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 4842 of 5017
Post > Topic >>

Re: centr of rotation/centering

by Ken <ken@[EMAIL PROTECTED] > Jul 22, 2008 at 01:17 PM

On Jul 21, 7:07=A0am, Luc Moulinier <mou...@[EMAIL PROTECTED]
> wrote:
> Hi !
>
> I'm new to OpenGL, and even after reading tutorials ans manuals, I
> still get some troubles.
> I'm doing a simple molecular viewer. For simplicity, let's say a
> molecules are each a cloud of points, whose centers are not at 0.0 0.0
> 0.0.
> I'd like to rotate it , translate it, and center on any atom, using
> the mouse.
>
> 1) Rotations: by dragging mouse button-1 , the user rotates around the
> x and y axis. X is always horizontal, and Y is always vertical,
> whatever the rotation. This works well. Tcl/Tk code of the event
> binded routine :
>
> proc Handl***** {x y win} {
> =A0 =A0 =A0 =A0 =A0global cx cy
>
> =A0 =A0 =A0 =A0 set mvmatrix [tcl3dVector GLdouble 16]
> =A0 =A0 =A0 =A0 glGetDoublev GL_MODELVIEW_MATRIX $mvmatrix
> =A0 =A0 =A0 =A0 set mvList =A0 [tcl3dVectorToList $mvmatrix 16]
>
> =A0 =A0 =A0 =A0 glMatrixMode GL_MODELVIEW
> =A0 =A0 =A0 =A0 glRotatef $dy [lindex $mvList 0] [lindex $mvList 4]
[lind=
ex $mvList
> 8]
>
> =A0 =A0 =A0 =A0 glGetDoublev GL_MODELVIEW_MATRIX $mvmatrix
> =A0 =A0 =A0 =A0 set mvList =A0 [tcl3dVectorToList $mvmatrix 16]
> =A0 =A0 =A0 =A0 glRotatef $dx [lindex $mvList 1] [lindex $mvList 5]
[lind=
ex $mvList
> 9]
>
> =A0 =A0 =A0 =A0 set cx $x
> =A0 =A0 =A0 =A0 set cy $y
>
> =A0 =A0 =A0 =A0 $win postredisplay
> =A0 =A0 =A0 =A0return
>
> }
>
> 2) Translation : I can translate the objects, but when I apply a
> rotation, the rotation center is the old rotation center. I 'd like
> the rotation center to stay always the center of the scene, and
> objects spinning depending on translation.
>
> 3) centering: I handle picking and labelling of atoms using NameLists.
> I didn't succeed to define the center at the X,Y,Z of the picked
> point.
>
> I'm aware there is the gluLookAt function, but How do I retrieve the
> eye position ? I don't use gluLookAt at present in my app, so I don't
> know if the "eye" position has moved or not, or if it is still at 0.0
> 0.0 0.0
>
> I would be very gratfull to anybody who could help me !!
>
> Luc

For point 2), ensure the order is translate then rotate and the effect
will be ***ulative.
 




 2 Posts in Topic:
centr of rotation/centering
Luc Moulinier <moumou@  2008-07-21 06:07:08 
Re: centr of rotation/centering
Ken <ken@[EMAIL PROTEC  2008-07-22 13:17:32 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 7:20:07 CST 2008.