gluLookAtでMultiplyされる行列を自前で作る場合、以下のようにすればokです。

If you want to get the matrix that is generated by gluLookAt, here is the way to do it.

   1    //gluLookAt(
   2    //  eye[0], eye[1], eye[2],
   3    //  at[0], at[1], at[2],
   4    //  0.0, 1.0, 0.0);
   5    // equivalent pseudo code
   6    float lookat[16];
   7    midentity(lookat);
   8    vec3 *s = (vec3*)&lookat[0];
   9    vec3 *u = (vec3*)&lookat[4];
  10    vec3 *f = (vec3*)&lookat[8];
  11    vec3 *t = (vec3*)&lookat[12];
  12    vcpy(t, &eye);
  13    vneg(t);
  14    vsub(f, &at, &eye);
  15    vnormalize(f);    
  16    vec3 up = {0, 1, 0};
  17    vcross(s, f, &up);
  18    vcross(u, s, f);  
  19    vneg(f);      
  20    glMultMatrixf(lookat);

posted by Png takiuchi on Sun 16 Aug 2009 at 14:44
Contents
gluLookAtの等価表現
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ