これは本当に簡単な質問です。
gluUnproject はどこで呼び出せますか? ある種の現在の openGL コンテキストが必要ですか?
ここで関数を調べましたが、何らかの前提条件があるかどうかはわかりません。
私はこれをしたい:
GLdouble near[3];
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
eq::Matrix4f projection;
getView()->getProjection(projection);
GLdouble *projMatrix = Matrix4d(projection).array;
glMultMatrixd(projMatrix);
glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
eq::Matrix4f camera;
getView()->getCamera(camera);
GLdouble *modelMatrix = Matrix4d(camera).array;
glMultMatrixd(modelMatrix);
const PixelViewport pvp = event.context.pvp;
int viewport[4] = {pvp.x, pvp.y, pvp.w, pvp.h};
// SCREEN HEIGHT NOT CONTEXT HEIGHT
const int y = (int)getWindow()->getPixelViewport().h - event.pointerButtonPress.y;
gluUnProject(
event.pointerButtonPress.x,
y,
0.0,
modelMatrix,
projMatrix,
viewport,
&near[0],
&near[1],
&near[2]
);
near[2] = 1.0f;
GLdouble far[3] = {near[0],near[1], -1.0f};
レンダーノードに渡す代わりに、サーバーノードで結果を返してもらいます。サーバーには openGL コンテキストがありません。gluUnproject を呼び出すことはできますか?