diff --git a/GraphicsView/include/CGAL/Qt/camera.h b/GraphicsView/include/CGAL/Qt/camera.h index 8b4ed1d2e00..08f76d4eb0b 100644 --- a/GraphicsView/include/CGAL/Qt/camera.h +++ b/GraphicsView/include/CGAL/Qt/camera.h @@ -475,7 +475,7 @@ inline void read_pixel(const QPoint &pixel, QOpenGLFunctions *p, GLvoid *pixel_data) { const auto pixel_ratio = camera->devicePixelRatio(); p->glReadPixels(pixel.x() * pixel_ratio, - (camera->screenHeight() - 1 - pixel.y()) * pixel_ratio, 1, 1, + (camera->screenHeight() - pixel.y()) * pixel_ratio - 1, 1, 1, format, type, pixel_data); } diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 065d3f9e8d8..f7b5846dc51 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -563,9 +563,8 @@ void Scene::renderScene(const QList &items, if(with_names) { // read depth buffer at pick location; - float depth = 1.0; - depth = read_depth_under_pixel(picked_pixel, viewer, viewer->camera()); - if (depth != 1.0) + float depth = read_depth_under_pixel(picked_pixel, viewer, viewer->camera()); + if (depth < 2.0) { //add object to list of picked objects; picked_item_IDs[depth] = index;