最終更新:
mikk_ni3_92 2009年08月28日(金) 10:36:51履歴
現在地:メニュー >> NVIDIA_SDK >> NVIDIA_SDK_02
【例】
※マウス関連のコールバック関数内に、
ボタン判定処理などを書かなくて済むのは、便利かもしれない。
- 動作設定
- マウスコールバック関数で、メンバ関数を呼ぶ。
- 描画時にメンバ関数を呼ぶ
【例】
#include <nvGlutManipulators.h> ... ... nv::GlutExamine manipulator; //マウス操作用マニピュレータ ... ... //------- 動作設定 ---------// manipulator.setTrackballScale(2.0);//トラックボール(回転処理の速度) manipulator.setDollyActivate( GLUT_LEFT_BUTTON, GLUT_ACTIVE_CTRL);//左ドラッグ+ctl → dolly移動処理 manipulator.setPanActivate( GLUT_LEFT_BUTTON, GLUT_ACTIVE_SHIFT);//左ドラッグ+Shfit → pan移動処理 ... ... void reshape(int w, int h) { ... ... manipulator.reshape(w, h);//ここでも呼ぶ必要がある } ... ... void myMouseFunc(int button,int state,int x,int y) { manipulator.mouse(button, state, x, y); } void myMouseMotion(int x,int y) { manipulator.motion(x, y); } ... ... void display() { ... ... manipulator.applyTransform();//移動を適用する(回転、平行、拡大縮小など) ... 描画 ... glutSwapBuffers(); }
※マウス関連のコールバック関数内に、
ボタン判定処理などを書かなくて済むのは、便利かもしれない。