replace deprecated gluPickMatrix

This commit is contained in:
wmayer 2017-03-06 11:18:19 +01:00
parent b1347ec12b
commit 7711d71410
2 changed files with 12 additions and 2 deletions

View File

@ -267,7 +267,12 @@ void SoFCIndexedFaceSet::startSelection(SoAction * action)
//glGetDoublev(GL_PROJECTION_MATRIX ,mp);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(x, y, w, h, viewport);
// See https://www.opengl.org/discussion_boards/showthread.php/184308-gluPickMatrix-Implementation?p=1259884&viewfull=1#post1259884
//gluPickMatrix(x, y, w, h, viewport);
if (w > 0 && h > 0) {
glTranslatef((viewport[2] - 2 * (x - viewport[0])) / w, (viewport[3] - 2 * (y - viewport[1])) / h, 0);
glScalef(viewport[2] / w, viewport[3] / h, 1.0);
}
glMultMatrixf(/*mp*/(float*)proj);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();

View File

@ -899,7 +899,12 @@ void SoFCMeshObjectShape::startSelection(SoAction * action, const Mesh::MeshObje
//glGetDoublev(GL_PROJECTION_MATRIX ,mp);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(x, y, w, h, viewport);
// See https://www.opengl.org/discussion_boards/showthread.php/184308-gluPickMatrix-Implementation?p=1259884&viewfull=1#post1259884
//gluPickMatrix(x, y, w, h, viewport);
if (w > 0 && h > 0) {
glTranslatef((viewport[2] - 2 * (x - viewport[0])) / w, (viewport[3] - 2 * (y - viewport[1])) / h, 0);
glScalef(viewport[2] / w, viewport[3] / h, 1.0);
}
glMultMatrixf(/*mp*/this->projection);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();