mirror of https://github.com/CGAL/cgal
Fix the picking
This commit is contained in:
parent
213da3115f
commit
b32619fedd
|
|
@ -475,7 +475,7 @@ inline void read_pixel(const QPoint &pixel, QOpenGLFunctions *p,
|
||||||
GLvoid *pixel_data) {
|
GLvoid *pixel_data) {
|
||||||
const auto pixel_ratio = camera->devicePixelRatio();
|
const auto pixel_ratio = camera->devicePixelRatio();
|
||||||
p->glReadPixels(pixel.x() * pixel_ratio,
|
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);
|
format, type, pixel_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -563,9 +563,8 @@ void Scene::renderScene(const QList<Scene_interface::Item_id> &items,
|
||||||
if(with_names) {
|
if(with_names) {
|
||||||
|
|
||||||
// read depth buffer at pick location;
|
// read depth buffer at pick location;
|
||||||
float depth = 1.0;
|
float depth = read_depth_under_pixel(picked_pixel, viewer, viewer->camera());
|
||||||
depth = read_depth_under_pixel(picked_pixel, viewer, viewer->camera());
|
if (depth < 2.0)
|
||||||
if (depth != 1.0)
|
|
||||||
{
|
{
|
||||||
//add object to list of picked objects;
|
//add object to list of picked objects;
|
||||||
picked_item_IDs[depth] = index;
|
picked_item_IDs[depth] = index;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue