[osg-users] Visualization problem on iMac 5K

Stefan Buschmann s_buschmann at gmx.de
Thu Mar 10 13:08:51 PST 2016


Hi,

that's a typical error when working with high-resolution (retina) 
displays. The issue here is that on the high-resolution devices, the UI 
operates with a virtual pixel size that is smaller than the real number 
of pixels on the device. For example, you get coordinates from 0 to 2048 
while the real device resolution if 4096 pixels. This factor has to be 
taken into account when mapping from window coordinates to OpenGL, e.g., 
when calling glViewport.

How you can get this factor depends on the GUI library you are using. In 
Qt, you can query it with QWindow::devicePixelRatio():
   http://doc.qt.io/qt-5/qwindow.html#devicePixelRatio

So, there should be something like
   glViewport(0, 0, window->width() * window->devicePixelRatio(), 
window->height() * window->devicePixelRatio()).

Also keep in mind that you have to do the same e.g. for mouse coordinates.

I think osgQt already handles this correctly, so you shouldn't have to 
worry about this if you use the classes provided by osgQt ...

Regards,

Stefan


On 10.03.2016 17:25, Ale Maro wrote:
> Hi,
>
> I recently compiled my application on OS X (it is a Qt based application).
> Everything is working fine on Mac Mini (with Intel Iris graphics card).... and the same code on Windows also works fine.
> When I tried on an iMac 5K (ATI Radeon R9 M290) I had a visualization problem.
> The view is shown in the bottom left quadrant of the windows (instead of covering the entire window) and the other quadrants are not refreshed.
>
> I tried with any resolution and the problem remains the same.
> Any ideas?
>
> Thank you for any help.
>
> Best regards,
> Ale
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=66512#66512
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list