Merge pull request #1547 from openscad/issue1523
Check error code from glReadPixels() to prevent invalid zoom.
This commit is contained in:
commit
10a0285f81
1 changed files with 5 additions and 0 deletions
|
|
@ -201,7 +201,12 @@ void QGLView::mouseDoubleClickEvent (QMouseEvent *event) {
|
|||
double y = viewport[3] - event->pos().y() * this->getDPI();
|
||||
GLfloat z = 0;
|
||||
|
||||
glGetError(); // clear error state so we don't pick up previous errors
|
||||
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &z);
|
||||
GLenum glError = glGetError();
|
||||
if (glError != GL_NO_ERROR) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (z == 1) return; // outside object
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue