SteeleR
10-29-2006, 08:51 AM
GLuint selectBuf[100];
GLint hits;
GLint viewport[4];
glGetIntegerv (GL_VIEWPORT, viewport);
glSelectBuffer (100, selectBuf);
glRenderMode(GL_SELECT);
glInitNames();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix( cX, viewport[3]-cY, 5.0, 5.0, viewport);
glMatrixMode(GL_MODELVIEW);
DrawObjects();
glPopMatrix();
glFlush();
hits = glRenderMode (GL_RENDER);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
cX and cY are the current mouse coords... but when the SELECT mode is trigged.. the viewport becomes only a small part of the screen and the selection of the objects can be done only there.. i.e. if i draw a red rectangle and press the mouse on or near it.. the screen becames red and I can only select there.. so the result is always this rect. Any ideas how to fix it?
10x...
GLint hits;
GLint viewport[4];
glGetIntegerv (GL_VIEWPORT, viewport);
glSelectBuffer (100, selectBuf);
glRenderMode(GL_SELECT);
glInitNames();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix( cX, viewport[3]-cY, 5.0, 5.0, viewport);
glMatrixMode(GL_MODELVIEW);
DrawObjects();
glPopMatrix();
glFlush();
hits = glRenderMode (GL_RENDER);
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
cX and cY are the current mouse coords... but when the SELECT mode is trigged.. the viewport becomes only a small part of the screen and the selection of the objects can be done only there.. i.e. if i draw a red rectangle and press the mouse on or near it.. the screen becames red and I can only select there.. so the result is always this rect. Any ideas how to fix it?
10x...