Fixes for Mac build and crash on startup

For some reason the qt code gen is getting confused by the #if 0
in 3DConnextionClient.h, so I added a stub implementation.

In Application.cpp the change of moving idle into paintGL had a sideeffect
of calling OffscreenGlCanvas before it was initialized.  To work around this
I added a guard to prevent calling idle before all the gl windows/widgets have
been initialized.
This commit is contained in:
Anthony J. Thibault 2015-11-04 12:04:34 -08:00
parent 8954d21ed1
commit 69f1cfbcb9
3 changed files with 23 additions and 7 deletions

View file

@ -940,14 +940,12 @@ void Application::initializeGL() {
qCDebug(interfaceapp) << "Created Display Window.";
// initialize glut for shape drawing; Qt apparently initializes it on OS X
#ifndef __APPLE__
static bool isInitialized = false;
if (isInitialized) {
if (_isGLInitialized) {
return;
} else {
isInitialized = true;
_isGLInitialized = true;
}
#endif
// Where the gpuContext is initialized and where the TRUE Backend is created and assigned
gpu::Context::init<gpu::GLBackend>();
_gpuContext = std::make_shared<gpu::Context>();
@ -1059,7 +1057,9 @@ void Application::paintGL() {
_lastFramesPerSecondUpdate = now;
}
idle(now);
if (_isGLInitialized) {
idle(now);
}
PROFILE_RANGE(__FUNCTION__);
PerformanceTimer perfTimer("paintGL");

View file

@ -414,7 +414,7 @@ private:
bool _dependencyManagerIsSetup;
OffscreenGlCanvas* _offscreenContext;
OffscreenGlCanvas* _offscreenContext {nullptr};
DisplayPluginPointer _displayPlugin;
InputPluginList _activeInputPlugins;
@ -548,6 +548,7 @@ private:
quint64 _lastSimsPerSecondUpdate = 0;
bool _isForeground = true; // starts out assumed to be in foreground
bool _inPaint = false;
bool _isGLInitialized {false};
};
#endif // hifi_Application_h

View file

@ -220,4 +220,19 @@ public:
#endif
#include <QObject>
#include <QLibrary>
// stub
class ConnexionClient : public QObject {
Q_OBJECT
public:
static ConnexionClient& getInstance();
void init() {};
void destroy() {};
bool Is3dmouseAttached() { return false; };
public slots:
void toggleConnexion(bool shouldEnable) {};
};
#endif // defined(hifi_3DConnexionClient_h)