GillesDebunne / libQGLViewer

libQGLViewer is an open source C++ library based on Qt that eases the creation of OpenGL 3D viewers.
Other
245 stars 94 forks source link

Incorrect selection with retina display #22

Closed kerautret closed 1 year ago

kerautret commented 8 years ago

It looks like that the face selection on mac OSX retina display is not correct: The direction of convertClickToLine looks fine, but the pointUnderPixel is wrong: From the lib example "select.cpp" on retina display:

selectiononretinadisplay

If I just test with my second screen which is not retina it is fine: selectiononclassicdisplay

GillesDebunne commented 8 years ago

This is related to 'retina' displays, and the times 2 scaling between physical and device pixels.

This is just a matter of multiplying / dividing by devicePixelRatio (i.e. 2) in a few places.

Unfortunately, it is not clear which places require it in the code, except around uses of width() and height() witch are known to cause problems with a QGLWidget.

kerautret commented 8 years ago

Thanks for you reply, Yes you are right, I also found this blog which mention it: http://blog.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/ If you want I can have a try if you have some idea where is the best to apply the widget->windowHandle()->devicePixelRatio()

GillesDebunne commented 1 year ago

It took some time, but this issue has been fixed in the 2.9.0 version of the library.

kerautret commented 1 year ago

Excellent 🎉 Thanks a lo! ;) I just see some compilation issue (see #64)