GillesDebunne / libQGLViewer

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

Compiling issues in Qt5.12.12 Ubuntu20.04 #72

Open nihenniuma opened 1 year ago

nihenniuma commented 1 year ago

qglviewer.cpp: In member function'void QGLViewer::setCamera(qglviewer::Camera*)': qglviewer.cpp:684:14: error: 'screen' was not declared in this scope;did you mean 'QScreen'?

nihenniuma commented 1 year ago

libQGLViewer-2.9.1

niko-zvt commented 1 year ago

@nihenniuma I ran into the same problem when building on Apple M2 Pro (clang x64, macosx13.3, qt 5.9.9). The explicit screen selection helped me. This may not work for multi-screen systems. You will need to select a specific screen.

QScreen *screen = QGuiApplication::primaryScreen();

For example:

camera->setDevicePixelRatio(screen->devicePixelRatio());

@GillesDebunne it seems that the screen() function is not available in a UNIX-environment. Is explicit screen selection enough, as I presented above?