arcBall - how to rotate it __proper__

  • Follow


Hi

I am writing a program in Java to display VRML files;  I am also using 
arcBall implementation form Nehe lesson(i spend a half a day to convert code 
form vc++ to Java ) and It works; But When I load models I use gluLookAt 
function like below to have it dispayed form given vievpoint:

--cut--
gl.glMatrixMode (GL.GL_PROJECTION_MATRIX);
gl.glLoadIdentity();

glu.gluLookAt( vp.position.x, vp.position.y, vp.position.z,
          0,0,0,
          vp.orientation.x,  vp.orientation.y,  vp.orientation.z);

//some defined position

gl.glMatrixMode (GL.GL_MODELVIEW);

gl.glTranslatef(arcBallPos.X,arcBallPos.Y,arcBallPos.Z);

  float[] M=
  {
   Transform.M00,Transform.M10,Transform.M20,Transform.M30,
   Transform.M01,Transform.M11,Transform.M21,Transform.M31,
   Transform.M02,Transform.M12,Transform.M22,Transform.M32,
   Transform.M03,Transform.M13,Transform.M23,Transform.M33
  };
     gl.glMultMatrixf(M);

model.draw();

--cut--

when I use rotation(drag mouse) - it rotates me in wrog direction - 
sometimes;

i was thinking to do that:
= i have a model - i do not do anything wit it -it is static(its position);
= changes only wievpoints - camera pos and dest pos;
= my arcball s the thing though my model looks as if is is rotating - but:
1. the model have statioc position
==> so i have to multiply some way the viewpoint and the coords of my 
arcball

HOW???

I need Your help!
any help welcomed!!!
-- 
wito





0
Reply wito 1/21/2006 11:29:52 PM


0 Replies
205 Views

(page loaded in 0.022 seconds)


Reply: