query: tag:opengl

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

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

c>>
//gluLookAt(
// eye[0], eye[1], eye[2],
// at[0], at[1], at[2],
// 0.0, 1.0, 0.0);
// equivalent pseudo code
float lookat[16];
midentity(lookat);
vec3 s = (vec3)&lookat[0];
vec3 u = (vec3)&lookat[4];
vec3 f = (vec3)&lookat[8];
vec3 t = (vec3)&lookat[12];
vcpy(t, &eye);
vneg(t);
vsub(f, &at, &eye);
vnormalize(f);
vec3 up = {0, 1, 0};
vcross(s, f, &up);
vcross(u, s, f);
vneg(f);
glMultMatrixf(lookat);
<<--

posted by takiuchi takiuchi on Sun 16 Aug 2009 at 14:34 with 0 comments

I've preferred FLTK for easy development of GUI tool.
It has function to treat OpenGL easily, but it doesn't provide box but only window as "Fl_Gl_Window".
If you need OpenGL in the box, since it is not supplied as its package, so thus you must use the "Fl_Gl_Box".

簡単なGUI toolを作るときには、ながらくFLTKを愛用してきました。
特にOpenGLを簡単に利用できるので、ちょっとした実験には最適です。
しかし、FLTKのパッケージには、OpenGL用にWindowを作るものはあるのですが、Box (Windowの中に配置される子Windowのようなもの)はありませんでした。そのような状況では、Fl_Gl_Boxを使う必要があります。

Unfortunately, it had been lost in the internet space (the original author of the library had used GeoCities and the site had been vanished), but I found it here.

残念ながら、Fl_Gl_Boxの配布サイトは消えてしまったようです。
しかし、幸運にも Fl_Gl_Boxのソースを以下に発見しました。

http://www.gnu-science.org/phpBB3/viewtopic.php?f=7&t=45#p1268

I'm feeling lucky :-)

ラッキーですね。

posted by takiuchi takiuchi on Tue 4 Aug 2009 at 20:08 with 0 comments