【发布时间】:2010-11-20 09:19:45
【问题描述】:
我正在尝试使用 Pyglet 的 OpenGL 包装器实现拾取,但在将 C tutorial 转换为 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 做到这一点?谢谢。
【问题讨论】:
标签: python opengl pyglet picking