我正在尝试使用 Pyglet 的 OpenGL 包装器实现拾取,但在将C 教程转换为 Python 时遇到了麻烦。具体如下部分。
#define BUFSIZE 512
GLuint selectBuf[BUFSIZE]
无效 startPicking(int cursorX,int cursorY){
GLint视口[4];
glSelectBuffer(BUFSIZE,selectBuf);
glRenderMode(GL_SELECT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glGetIntegerv(GL_VIEWPORT,viewport);
gluPickMatrix(cursorX,viewport[3]-cursorY,
5,5,视口);
gluPerspective(45,ratio,0.1,1000);
glMatrixMode(GL_MODELVIEW);
glInitNames();
}
我不确定如何打开声明 GLuint 或 GLint 的数组,以便 glSelectBuffer 和 glPickMatrix 工作。有谁知道如何在 Python 中使用 Pyglet 做到这一点?谢谢。