how to rotate a camera?


    Dec 29 2007 | 8:55 pm
    i am a bit confused regarding the position and rotate (and rotatexyz)
    attribute of the jit.gl.render.
    do they operate as a freelooking camera? (like camera and lookat but with
    lookat bound to the camera normal?)
    it seems that way.
    i have a project in which i camera position and rotation. as there is not
    way to rotate the camera, should i abandon the camera/lookat and apply
    transformations to gl.render directly?

    • Dec 29 2007 | 11:08 pm
      from looking at the opengl docs, i see the camera messages to gl.render are
      only helpers and are not part of the specs. that means i have to roll my own
      if i want pitch roll and yaw? lua?
      On Dec 29, 2007 10:55 PM, yair reshef wrote:
      > i am a bit confused regarding the position and rotate (and rotatexyz)
      > attribute of the jit.gl.render.
      > do they operate as a freelooking camera? (like camera and lookat but with
      > lookat bound to the camera normal?)
      > it seems that way.
      > i have a project in which i camera position and rotation. as there is not
      > way to rotate the camera, should i abandon the camera/lookat and apply
      > transformations to gl.render directly?
      >
    • Dec 30 2007 | 12:21 am
      hi
      send the "up" message to a jit.gl.render ,you roll the camera
      default is "up 0 1 0" == pointing camera up to y
      look at html-help of jit.gl.render
      but to rotate camera around an object or target point you have to
      calulate by yourselve i think
      -mj
      Op 30 dec 2007, om 00:08 heeft yair reshef het volgende geschreven:
      > from looking at the opengl docs, i see the camera messages to
      > gl.render are only helpers and are not part of the specs. that means
      > i have to roll my own if i want pitch roll and yaw? lua?
      >
      > On Dec 29, 2007 10:55 PM, yair reshef < yair99@gmail.com> wrote:
      > i am a bit confused regarding the position and rotate (and
      > rotatexyz) attribute of the jit.gl.render.
      > do they operate as a freelooking camera? (like camera and lookat but
      > with lookat bound to the camera normal?)
      > it seems that way.
      > i have a project in which i camera position and rotation. as there
      > is not way to rotate the camera, should i abandon the camera/lookat
      > and apply transformations to gl.render directly?
      >
    • Dec 30 2007 | 12:51 am
      missed that one, thanks~
      On Dec 30, 2007 2:21 AM, MJ wrote:
      > hi
      > send the "up" message to a jit.gl.render ,you roll the cameradefault is
      > "up 0 1 0" == pointing camera up to y
      >
      > look at html-help of jit.gl.render
      >
      > but to rotate camera around an object or target point you have to calulate
      > by yourselve i think
      >
      >
      >
      > -mj
      >
      > Op 30 dec 2007, om 00:08 heeft yair reshef het volgende geschreven:
      >
      > from looking at the opengl docs, i see the camera messages to gl.renderare only helpers and are not part of the specs. that means i have to roll my
      > own if i want pitch roll and yaw? lua?
      >
      > On Dec 29, 2007 10:55 PM, yair reshef < yair99@gmail.com> wrote:
      >
      > > i am a bit confused regarding the position and rotate (and rotatexyz)
      > > attribute of the jit.gl.render.
      > > do they operate as a freelooking camera? (like camera and lookat but
      > > with lookat bound to the camera normal?)
      > > it seems that way.
      > > i have a project in which i camera position and rotation. as there is
      > > not way to rotate the camera, should i abandon the camera/lookat and apply
      > > transformations to gl.render directly?
      > >
      >
      >
      >
      >
      >
      >
    • Dec 30 2007 | 1:31 am
      that up vector att. gives me strange results.
      the help calls it a 3 float but it seems the first two floats act on the
      same axis and the third one does nothing
      On Dec 30, 2007 2:51 AM, yair reshef wrote:
      > missed that one, thanks~
      >
      >
      > On Dec 30, 2007 2:21 AM, MJ wrote:
      >
      > > hi
      > > send the "up" message to a jit.gl.render ,you roll the cameradefault is
      > > "up 0 1 0" == pointing camera up to y
      > >
      > > look at html-help of jit.gl.render
      > >
      > > but to rotate camera around an object or target point you have to
      > > calulate by yourselve i think
      > >
      > >
      > >
      > > -mj
      > >
      > > Op 30 dec 2007, om 00:08 heeft yair reshef het volgende geschreven:
      > >
      > > from looking at the opengl docs, i see the camera messages to gl.renderare only helpers and are not part of the specs. that means i have to roll my
      > > own if i want pitch roll and yaw? lua?
      > >
      > > On Dec 29, 2007 10:55 PM, yair reshef < yair99@gmail.com> wrote:
      > >
      > > > i am a bit confused regarding the position and rotate (and rotatexyz)
      > > > attribute of the jit.gl.render.
      > > > do they operate as a freelooking camera? (like camera and lookat but
      > > > with lookat bound to the camera normal?)
      > > > it seems that way.
      > > > i have a project in which i camera position and rotation. as there is
      > > > not way to rotate the camera, should i abandon the camera/lookat and apply
      > > > transformations to gl.render directly?
      > > >
      > >
      > >
      > >
      > >
      > >
      > >
      >
    • Dec 30 2007 | 6:56 am
      well if you put the up vector along the z-axis you would change the
      lookat point
      the other two are the x and y axis
      like this
      Op 30 dec 2007, om 02:31 heeft yair reshef het volgende geschreven:
      > that up vector att. gives me strange results.
      > the help calls it a 3 float but it seems the first two floats act on
      > the same axis and the third one does nothing
      >
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P newex 0 180 40 9109513 r render;
      > #P flonum 192 255 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P flonum 156 255 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P flonum 120 255 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P newex 120 286 69 9109513 pak up 0. 0. 0.;
      > #B color 5;
      > #P newex 95 146 40 9109513 change;
      > #P newex 40 206 83 9109513 jit.gl.render thither;
      > #B color 5;
      > #P message 93 176 55 9109513 texture grid;
      > #P window linecount 2;
      > #P newex 151 175 154 9109513 jit.gl.gridshape thither @scale 0.5 0.5
      > 0.5 @texture grid @shape cube;
      > #P window linecount 1;
      > #P comment 161 136 105 9109513 hit esc for fullscreen.;
      > #P newex 40 146 53 9109513 t b b erase;
      > #P window linecount 3;
      > #P newex 162 92 111 9109513 jit.window thither @rect 10 50 160 160
      > @floating 1;
      > #P toggle 40 102 15 0;
      > #P window linecount 1;
      > #P newex 40 123 55 9109513 metro 20;
      > #P toggle 246 51 15 0;
      > #P newex 207 50 35 9109513 sel 27;
      > #P newex 162 50 40 9109513 key;
      > #P newex 162 72 91 9109513 prepend fullscreen;
      > #P newex 120 376 42 9109513 s render;
      > #P hidden newex 219 595 42 9109513 s render;
      > #P flonum 369 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 333 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 297 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 297 347 95 9109513 pak camera 0. 0. 0.;
      > #P flonum 222 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 186 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 150 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 150 347 89 9109513 pak lookat 0. 0. 0.;
      > #P fasten 27 0 21 0 5 202 45 202;
      > #P connect 23 0 9 0;
      > #P fasten 26 0 23 3 197 278 182 278;
      > #P fasten 25 0 23 2 161 278 163 278;
      > #P fasten 24 0 23 1 125 278 144 278;
      > #P connect 15 0 14 0;
      > #P fasten 15 0 22 0 100 117;
      > #P connect 22 1 20 0;
      > #P connect 17 2 21 0;
      > #P connect 17 0 21 0;
      > #P connect 20 0 21 0;
      > #P fasten 0 0 9 0 155 371 125 371;
      > #P fasten 4 0 9 0 302 371 125 371;
      > #P fasten 7 0 4 3 374 339 386 339;
      > #P fasten 6 0 4 2 338 339 358 339;
      > #P fasten 5 0 4 1 302 339 330 339;
      > #P fasten 3 0 0 3 227 339 233 339;
      > #P fasten 2 0 0 2 191 339 207 339;
      > #P fasten 1 0 0 1 155 339 181 339;
      > #P connect 14 0 17 0;
      > #P fasten 12 0 13 0 212 68 243 68 243 48 251 48;
      > #P fasten 11 0 12 0 167 69 204 69 204 48 212 48;
      > #P connect 10 0 16 0;
      > #P fasten 13 0 10 0 251 70 167 70;
      > #P window clipboard copycount 28;
      >
      >
      >
      > On Dec 30, 2007 2:51 AM, yair reshef < yair99@gmail.com> wrote:
      > missed that one, thanks~
      >
      >
      > On Dec 30, 2007 2:21 AM, MJ wrote:
      > hi
      > send the "up" message to a jit.gl.render ,you roll the camera
      > default is "up 0 1 0" == pointing camera up to y
      >
      > look at html-help of jit.gl.render
      >
      > but to rotate camera around an object or target point you have to
      > calulate by yourselve i think
      >
      >
      >
      > -mj
      >
      > Op 30 dec 2007, om 00:08 heeft yair reshef het volgende geschreven:
      >
      >> from looking at the opengl docs, i see the camera messages to
      >> gl.render are only helpers and are not part of the specs. that
      >> means i have to roll my own if i want pitch roll and yaw? lua?
      >>
      >> On Dec 29, 2007 10:55 PM, yair reshef < yair99@gmail.com> wrote:
      >> i am a bit confused regarding the position and rotate (and
      >> rotatexyz) attribute of the jit.gl.render.
      >> do they operate as a freelooking camera? (like camera and lookat
      >> but with lookat bound to the camera normal?)
      >> it seems that way.
      >> i have a project in which i camera position and rotation. as there
      >> is not way to rotate the camera, should i abandon the camera/lookat
      >> and apply transformations to gl.render directly?
      >>
      >
      >
      >
      >
      >
    • Dec 31 2007 | 12:25 pm
      ok, i'll try it another way.
      assume i have a point in space (camera).
      -5.10 0.33 -3.56 xyz
      and an angle direction at which this point is looking (look at)
      -11.465012 -4.556370 50.838782 roll,pitch,yaw
      what is the formula i'm looking for to bind the lookat to this point ?
      like finding a point that extends on a line given a degree and origin.
      i assume this will give me a freelooking camera i so need.
      thanks
      On Dec 30, 2007 8:56 AM, MJ wrote:
      > well if you put the up vector along the z-axis you would change the lookat
      > point the other two are the x and y axis
      > like this
      >
      > #P user gswitch2 407 287 39 32 1 0;
      > #P user gswitch2 358 289 39 32 1 0;
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #N counter 2 0 360;
      > #X flags 0 0;
      > #P newobj 399 104 83 196617 counter 2 0 360;
      > #P flonum 401 179 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 411 222 64 196617 / 57.29578;
      > #P newex 435 254 23 196617 cos;
      > #P newex 395 257 21 196617 sin;
      > #P newex 0 180 54 196617 r render;
      > #P flonum 455 366 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P flonum 419 366 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P flonum 383 366 35 9 0 0 0 3 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P newex 383 397 69 196617 pak up 0. 0. 0.;
      > #B color 5;
      > #P newex 95 146 40 196617 change;
      > #P newex 40 206 107 196617 jit.gl.render thither;
      > #B color 5;
      > #P message 93 176 69 196617 texture grid;
      > #P window linecount 2;
      > #P newex 151 175 173 196617 jit.gl.gridshape thither @scale 0.5 0.5 0.5@texture grid @shape cube;
      > #P window linecount 1;
      > #P comment 161 136 105 196617 hit esc for fullscreen.;
      > #P newex 40 146 53 196617 t b b erase;
      > #P window linecount 3;
      > #P newex 162 92 111 196617 jit.window thither @rect 10 50 160 160
      > @floating 1;
      > #P toggle 40 102 15 0;
      > #P window linecount 1;
      > #P newex 40 123 55 196617 metro 20;
      > #P toggle 246 51 15 0;
      > #P newex 207 50 35 196617 sel 27;
      > #P newex 162 50 40 196617 key;
      > #P newex 162 72 91 196617 prepend fullscreen;
      > #P newex 383 487 56 196617 s render;
      > #P hidden newex 219 595 56 196617 s render;
      > #P window linecount 2;
      > #P comment 483 223 100 196617 converting degrees to radials;
      > #P window linecount 1;
      > #P comment 459 295 100 196617 play with these;
      > #P connect 23 0 28 1;
      > #P connect 22 0 27 1;
      > #P connect 28 1 19 0;
      > #P connect 27 1 18 0;
      > #P connect 26 0 25 0;
      > #P fasten 11 1 26 0 66 168 368 168 368 90 404 90;
      > #P connect 24 0 22 0;
      > #P connect 24 0 23 0;
      > #P connect 25 0 24 0;
      > #P fasten 7 0 4 0 251 70 167 70;
      > #P connect 4 0 10 0;
      > #P fasten 5 0 6 0 167 69 204 69 204 48 212 48;
      > #P fasten 6 0 7 0 212 68 243 68 243 48 251 48;
      > #P connect 8 0 11 0;
      > #P connect 14 0 15 0;
      > #P connect 11 0 15 0;
      > #P connect 11 2 15 0;
      > #P connect 16 1 14 0;
      > #P fasten 9 0 16 0 100 117;
      > #P connect 9 0 8 0;
      > #P fasten 18 0 17 1 388 389 407 389;
      > #P fasten 19 0 17 2 424 389 426 389;
      > #P fasten 20 0 17 3 460 389 445 389;
      > #P connect 17 0 3 0;
      > #P fasten 21 0 15 0 5 202 45 202;
      > #P window clipboard copycount 29;
      >
      >
      > Op 30 dec 2007, om 02:31 heeft yair reshef het volgende geschreven:
      >
      > that up vector att. gives me strange results.
      > the help calls it a 3 float but it seems the first two floats act on the
      > same axis and the third one does nothing
      >
      > #P window setfont "Sans Serif" 9.;
      > #P window linecount 1;
      > #P newex 0 180 40 9109513 r render;
      > #P flonum 192 255 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P flonum 156 255 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P flonum 120 255 35 9 0 0 0 139 0 0 0 255 227 23 222 222 222 0 0 0;
      > #P newex 120 286 69 9109513 pak up 0. 0. 0.;
      > #B color 5;
      > #P newex 95 146 40 9109513 change;
      > #P newex 40 206 83 9109513 jit.gl.render thither;
      > #B color 5;
      > #P message 93 176 55 9109513 texture grid;
      > #P window linecount 2;
      > #P newex 151 175 154 9109513 jit.gl.gridshape thither @scale 0.5 0.5 0.5@texture grid @shape cube;
      > #P window linecount 1;
      > #P comment 161 136 105 9109513 hit esc for fullscreen.;
      > #P newex 40 146 53 9109513 t b b erase;
      > #P window linecount 3;
      > #P newex 162 92 111 9109513 jit.window thither @rect 10 50 160 160
      > @floating 1;
      > #P toggle 40 102 15 0;
      > #P window linecount 1;
      > #P newex 40 123 55 9109513 metro 20;
      > #P toggle 246 51 15 0;
      > #P newex 207 50 35 9109513 sel 27;
      > #P newex 162 50 40 9109513 key;
      > #P newex 162 72 91 9109513 prepend fullscreen;
      > #P newex 120 376 42 9109513 s render;
      > #P hidden newex 219 595 42 9109513 s render;
      > #P flonum 369 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 333 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 297 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 297 347 95 9109513 pak camera 0. 0. 0.;
      > #P flonum 222 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 186 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P flonum 150 316 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
      > #P newex 150 347 89 9109513 pak lookat 0. 0. 0.;
      > #P fasten 27 0 21 0 5 202 45 202;
      > #P connect 23 0 9 0;
      > #P fasten 26 0 23 3 197 278 182 278;
      > #P fasten 25 0 23 2 161 278 163 278;
      > #P fasten 24 0 23 1 125 278 144 278;
      > #P connect 15 0 14 0;
      > #P fasten 15 0 22 0 100 117;
      > #P connect 22 1 20 0;
      > #P connect 17 2 21 0;
      > #P connect 17 0 21 0;
      > #P connect 20 0 21 0;
      > #P fasten 0 0 9 0 155 371 125 371;
      > #P fasten 4 0 9 0 302 371 125 371;
      > #P fasten 7 0 4 3 374 339 386 339;
      > #P fasten 6 0 4 2 338 339 358 339;
      > #P fasten 5 0 4 1 302 339 330 339;
      > #P fasten 3 0 0 3 227 339 233 339;
      > #P fasten 2 0 0 2 191 339 207 339;
      > #P fasten 1 0 0 1 155 339 181 339;
      > #P connect 14 0 17 0;
      > #P fasten 12 0 13 0 212 68 243 68 243 48 251 48;
      > #P fasten 11 0 12 0 167 69 204 69 204 48 212 48;
      > #P connect 10 0 16 0;
      > #P fasten 13 0 10 0 251 70 167 70;
      > #P window clipboard copycount 28;
      >
      >
      >
      > On Dec 30, 2007 2:51 AM, yair reshef < yair99@gmail.com> wrote:
      >
      > > missed that one, thanks~
      > >
      > >
      > > On Dec 30, 2007 2:21 AM, MJ wrote:
      > >
      > > > hi
      > > > send the "up" message to a jit.gl.render ,you roll the cameradefault
      > > > is "up 0 1 0" == pointing camera up to y
      > > >
      > > > look at html-help of jit.gl.render
      > > >
      > > > but to rotate camera around an object or target point you have to
      > > > calulate by yourselve i think
      > > >
      > > >
      > > >
      > > > -mj
      > > >
      > > > Op 30 dec 2007, om 00:08 heeft yair reshef het volgende geschreven:
      > > >
      > > > from looking at the opengl docs, i see the camera messages to
      > > > gl.render are only helpers and are not part of the specs. that means i
      > > > have to roll my own if i want pitch roll and yaw? lua?
      > > >
      > > > On Dec 29, 2007 10:55 PM, yair reshef < yair99@gmail.com> wrote:
      > > >
      > > > > i am a bit confused regarding the position and rotate (and
      > > > > rotatexyz) attribute of the jit.gl.render.
      > > > > do they operate as a freelooking camera? (like camera and lookat but
      > > > > with lookat bound to the camera normal?)
      > > > > it seems that way.
      > > > > i have a project in which i camera position and rotation. as there
      > > > > is not way to rotate the camera, should i abandon the camera/lookat and
      > > > > apply transformations to gl.render directly?
      > > > >
      > > >
      > > >
      > > >
      > > >
      > > >
      > > >
      > >
      >
      >
      >
      >
      >
    • Jan 02 2008 | 11:52 am
    • Jan 02 2008 | 6:46 pm
      yair reshef wrote:
      > thanks, this is what i need!
      >
      >
      >
      > On Jan 2, 2008 1:52 PM, Vincent Goudard wrote:
      >
      >> Have you checked the "AdvancedCameraNavigation" in the jitter example
      >> patches?
      >> It is well done and give a good insight on how to handle the various
      >> camera parameters.
      >> ...vincent
      that patch is great, there is only one small bug in the normalization
      formula. (get vector length)
      expr (sqrt(pow($f1,2)))+(sqrt(pow($f2,2)))+(sqrt(pow($f3,2)))
      should be
      expr sqrt(pow($f1,2)+pow($f2,2)+pow($f3,2))
      marius.
    • Jan 02 2008 | 6:52 pm
      > that patch is great, there is only one small bug in the normalization
      > formula. (get vector length)
      > expr (sqrt(pow($f1,2)))+(sqrt(pow($f2,2)))+(sqrt(pow($f3,2)))
      > should be
      > expr sqrt(pow($f1,2)+pow($f2,2)+pow($f3,2))
      > marius.
      expr sqrt($f1*$f1+$f2*$f2+$f3*$f3)
      will be faster as it avoids the somewhat expensive pow calculation.
      wes
    • Jan 03 2008 | 10:36 pm
      havent followed this thread to closely, so apologies if this is not all that relevant... but should be helpful...
      check this thread:
      justin