Moved GLCanvas in DM and DM to QSharedPointers

This commit is contained in:
Atlante45 2014-12-15 16:20:52 -08:00
parent 68430e1346
commit e5e2eb4e8a
24 changed files with 143 additions and 146 deletions

View file

@ -194,7 +194,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_isVSyncOn(true),
_aboutToQuit(false)
{
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
// read the ApplicationInfo.ini file for Name/Version/Domain information
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
@ -365,7 +365,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
ResourceCache::setRequestLimit(3);
_window->setCentralWidget(glCanvas);
_window->setCentralWidget(glCanvas.data());
restoreSizeAndPosition();
@ -393,7 +393,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
checkVersion();
_overlays.init(glCanvas); // do this before scripts load
_overlays.init(glCanvas.data()); // do this before scripts load
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
@ -442,6 +442,8 @@ void Application::aboutToQuit() {
}
Application::~Application() {
DependencyManager::get<GLCanvas>()->setParent(NULL);
_entities.getTree()->setSimulation(NULL);
qInstallMessageHandler(NULL);
@ -1046,7 +1048,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (isShifted) {
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
if (TV3DManager::isConnected()) {
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
} else {
@ -1059,7 +1061,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (isShifted) {
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
if (TV3DManager::isConnected()) {
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
@ -1532,7 +1534,7 @@ void Application::idle() {
void Application::checkBandwidthMeterClick() {
// ... to be called upon button release
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
@ -1568,7 +1570,7 @@ void Application::setFullscreen(bool fullscreen) {
}
void Application::setEnable3DTVMode(bool enable3DTVMode) {
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
@ -1594,7 +1596,7 @@ void Application::setEnableVRMode(bool enableVRMode) {
_myCamera.setHmdRotation(glm::quat());
}
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
@ -1657,7 +1659,7 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox
bool Application::mouseOnScreen() const {
if (OculusManager::isConnected()) {
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() &&
getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight();
}
@ -1699,13 +1701,13 @@ int Application::getMouseDragStartedY() const {
}
FaceTracker* Application::getActiveFaceTracker() {
Faceshift* faceshift = DependencyManager::get<Faceshift>();
Visage* visage = DependencyManager::get<Visage>();
DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>();
QSharedPointer<Faceshift> faceshift = DependencyManager::get<Faceshift>();
QSharedPointer<Visage> visage = DependencyManager::get<Visage>();
QSharedPointer<DdeFaceTracker> dde = DependencyManager::get<DdeFaceTracker>();
return (dde->isActive() ? static_cast<FaceTracker*>(dde) :
(faceshift->isActive() ? static_cast<FaceTracker*>(faceshift) :
(visage->isActive() ? static_cast<FaceTracker*>(visage) : NULL)));
return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) :
(faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) :
(visage->isActive() ? static_cast<FaceTracker*>(visage.data()) : NULL)));
}
struct SendVoxelsOperationArgs {
@ -1778,7 +1780,7 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) {
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
QString suggestedName = desktopLocation.append("/voxels.svo");
QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>(),
QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>().data(),
tr("Export Voxels"), suggestedName,
tr("Sparse Voxel Octree Files (*.svo)"));
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
@ -2034,9 +2036,9 @@ void Application::init() {
_metavoxels.init();
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
_audio.init(glCanvas);
_rearMirrorTools = new RearMirrorTools(glCanvas, _mirrorViewRect, _settings);
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
_audio.init(glCanvas.data());
_rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings);
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
@ -2115,7 +2117,7 @@ void Application::updateMouseRay() {
void Application::updateFaceshift() {
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateFaceshift()");
Faceshift* faceshift = DependencyManager::get<Faceshift>();
Faceshift* faceshift = DependencyManager::get<Faceshift>().data();
// Update faceshift
faceshift->update();
@ -2919,7 +2921,7 @@ void Application::updateShadowMap() {
fbo->release();
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
@ -3247,7 +3249,7 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom
}
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
float horizontalScale = glCanvas->getDeviceWidth() / 2.0f;
float verticalScale = glCanvas->getDeviceHeight() / 2.0f;
@ -4260,7 +4262,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio
void Application::loadDialog() {
QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>(),
QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>().data(),
tr("Open Script"),
getPreviousScriptLocation(),
tr("JavaScript Files (*.js)"));
@ -4297,7 +4299,7 @@ void Application::loadScriptURLDialog() {
void Application::toggleLogDialog() {
if (! _logDialog) {
_logDialog = new LogDialog(DependencyManager::get<GLCanvas>(), getLogger());
_logDialog = new LogDialog(DependencyManager::get<GLCanvas>().data(), getLogger());
}
if (_logDialog->isVisible()) {
@ -4357,7 +4359,7 @@ void Application::parseVersionXml() {
}
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
new UpdateDialog(DependencyManager::get<GLCanvas>(), releaseNotes, latestVersion, downloadUrl);
new UpdateDialog(DependencyManager::get<GLCanvas>().data(), releaseNotes, latestVersion, downloadUrl);
}
sender->deleteLater();
}
@ -4390,7 +4392,7 @@ void Application::takeSnapshot() {
}
if (!_snapshotShareDialog) {
_snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>());
_snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>().data());
}
_snapshotShareDialog->show();
}

View file

@ -173,7 +173,6 @@ public:
glm::vec3 getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel);
bool isThrottleRendering() const { return DependencyManager::get<GLCanvas>()->isThrottleRendering(); }
GLCanvas* getGLWidget() { return DependencyManager::get<GLCanvas>(); } // TODO: remove
MyAvatar* getAvatar() { return _myAvatar; }
Audio* getAudio() { return &_audio; }
Camera* getCamera() { return &_myCamera; }

View file

@ -95,10 +95,8 @@ void Camera::setFarClip(float f) {
}
PickRay Camera::computePickRay(float x, float y) {
float screenWidth = Application::getInstance()->getGLWidget()->width();
float screenHeight = Application::getInstance()->getGLWidget()->height();
return computeViewPickRay(x / screenWidth, y / screenHeight);
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height());
}
PickRay Camera::computeViewPickRay(float xRatio, float yRatio) {

View file

@ -436,12 +436,12 @@ Menu::Menu() :
MenuOption::Faceshift,
0,
true,
DependencyManager::get<Faceshift>(),
DependencyManager::get<Faceshift>().data(),
SLOT(setTCPEnabled(bool)));
#endif
#ifdef HAVE_VISAGE
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::Visage, 0, false,
DependencyManager::get<Visage>(), SLOT(updateEnabled()));
DependencyManager::get<Visage>().data(), SLOT(updateEnabled()));
#endif
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSkeletonCollisionShapes);
@ -1050,11 +1050,11 @@ void Menu::bumpSettings() {
void sendFakeEnterEvent() {
QPoint lastCursorPosition = QCursor::pos();
QGLWidget* glWidget = Application::getInstance()->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
QPoint windowPosition = glWidget->mapFromGlobal(lastCursorPosition);
QPoint windowPosition = glCanvas->mapFromGlobal(lastCursorPosition);
QEnterEvent enterEvent = QEnterEvent(windowPosition, windowPosition, lastCursorPosition);
QCoreApplication::sendEvent(glWidget, &enterEvent);
QCoreApplication::sendEvent(glCanvas.data(), &enterEvent);
}
const float DIALOG_RATIO_OF_WINDOW = 0.30f;
@ -1302,7 +1302,7 @@ void Menu::toggleLoginMenuItem() {
void Menu::bandwidthDetails() {
if (! _bandwidthDialog) {
_bandwidthDialog = new BandwidthDialog(Application::getInstance()->getGLWidget(),
_bandwidthDialog = new BandwidthDialog(DependencyManager::get<GLCanvas>().data(),
Application::getInstance()->getBandwidthMeter());
connect(_bandwidthDialog, SIGNAL(closed()), SLOT(bandwidthDetailsClosed()));
@ -1413,7 +1413,7 @@ void Menu::bandwidthDetailsClosed() {
void Menu::octreeStatsDetails() {
if (!_octreeStatsDialog) {
_octreeStatsDialog = new OctreeStatsDialog(Application::getInstance()->getGLWidget(),
_octreeStatsDialog = new OctreeStatsDialog(DependencyManager::get<GLCanvas>().data(),
Application::getInstance()->getOcteeSceneStats());
connect(_octreeStatsDialog, SIGNAL(closed()), SLOT(octreeStatsDetailsClosed()));
_octreeStatsDialog->show();
@ -1597,7 +1597,7 @@ bool Menu::shouldRenderMesh(float largestDimension, float distanceToCamera) {
void Menu::lodTools() {
if (!_lodToolsDialog) {
_lodToolsDialog = new LodToolsDialog(Application::getInstance()->getGLWidget());
_lodToolsDialog = new LodToolsDialog(DependencyManager::get<GLCanvas>().data());
connect(_lodToolsDialog, SIGNAL(closed()), SLOT(lodToolsClosed()));
_lodToolsDialog->show();
if (_hmdToolsDialog) {
@ -1617,7 +1617,7 @@ void Menu::lodToolsClosed() {
void Menu::hmdTools(bool showTools) {
if (showTools) {
if (!_hmdToolsDialog) {
_hmdToolsDialog = new HMDToolsDialog(Application::getInstance()->getGLWidget());
_hmdToolsDialog = new HMDToolsDialog(DependencyManager::get<GLCanvas>().data());
connect(_hmdToolsDialog, SIGNAL(closed()), SLOT(hmdToolsClosed()));
}
_hmdToolsDialog->show();

View file

@ -71,20 +71,19 @@ void Head::reset() {
}
void Head::simulate(float deltaTime, bool isMine, bool billboard) {
if (isMine) {
MyAvatar* myAvatar = static_cast<MyAvatar*>(_owningAvatar);
// Only use face trackers when not playing back a recording.
if (!myAvatar->isPlaying()) {
FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();
DdeFaceTracker* dde = DependencyManager::get<DdeFaceTracker>();
Faceshift* faceshift = DependencyManager::get<Faceshift>();
QSharedPointer<DdeFaceTracker> dde = DependencyManager::get<DdeFaceTracker>();
QSharedPointer<Faceshift> faceshift = DependencyManager::get<Faceshift>();
if ((_isFaceshiftConnected = (faceshift == faceTracker))) {
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
} else if (dde->isActive()) {
faceTracker = dde;
faceTracker = dde.data();
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
}
}

View file

@ -422,7 +422,7 @@ void MyAvatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bo
}
void MyAvatar::renderHeadMouse(int screenWidth, int screenHeight) const {
Faceshift* faceshift = DependencyManager::get<Faceshift>();
QSharedPointer<Faceshift> faceshift = DependencyManager::get<Faceshift>();
float pixelsPerDegree = screenHeight / Menu::getInstance()->getFieldOfView();

View file

@ -18,8 +18,9 @@
#include "FaceTracker.h"
class DdeFaceTracker : public FaceTracker, public DependencyManager::Dependency {
class DdeFaceTracker : public FaceTracker {
Q_OBJECT
SINGLETON_DEPENDENCY
public:
//initialization
@ -58,7 +59,6 @@ private:
DdeFaceTracker();
DdeFaceTracker(const QHostAddress& host, quint16 port);
~DdeFaceTracker();
friend DependencyManager;
float getBlendshapeCoefficient(int index) const;
void decodePacket(const QByteArray& buffer);

View file

@ -24,8 +24,9 @@
#include "FaceTracker.h"
/// Handles interaction with the Faceshift software, which provides head position/orientation and facial features.
class Faceshift : public FaceTracker, public DependencyManager::Dependency {
class Faceshift : public FaceTracker {
Q_OBJECT
SINGLETON_DEPENDENCY
public:
void init();
@ -89,7 +90,6 @@ private slots:
private:
Faceshift();
virtual ~Faceshift() {}
friend DependencyManager;
float getBlendshapeCoefficient(int index) const;

View file

@ -560,8 +560,8 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
}
// restore our normal viewport
glViewport(0, 0, Application::getInstance()->getGLWidget()->getDeviceWidth(),
Application::getInstance()->getGLWidget()->getDeviceHeight());
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
glMatrixMode(GL_PROJECTION);
glPopMatrix();
@ -579,8 +579,8 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) {
glLoadIdentity();
gluOrtho2D(0, Application::getInstance()->getGLWidget()->getDeviceWidth(), 0,
Application::getInstance()->getGLWidget()->getDeviceHeight());
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
gluOrtho2D(0, glCanvas->getDeviceWidth(), 0, glCanvas->getDeviceHeight());
glDisable(GL_DEPTH_TEST);

View file

@ -215,8 +215,9 @@ void PrioVR::renderCalibrationCountdown() {
static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold,
false, TextRenderer::OUTLINE_EFFECT, 2);
QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "...";
textRenderer->draw((Application::getInstance()->getGLWidget()->width() -
textRenderer->computeWidth(text.constData())) / 2, Application::getInstance()->getGLWidget()->height() / 2,
text);
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
textRenderer->draw((glCanvas->width() - textRenderer->computeWidth(text.constData())) / 2,
glCanvas->height() / 2,
text);
#endif
}

View file

@ -461,7 +461,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
void SixenseManager::emulateMouse(PalmData* palm, int index) {
Application* application = Application::getInstance();
MyAvatar* avatar = application->getAvatar();
GLCanvas* widget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
QPoint pos;
Qt::MouseButton bumperButton;
@ -489,10 +489,10 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
// Get the pixel range over which the xAngle and yAngle are scaled
float cursorRange = widget->width() * getCursorPixelRangeMult();
float cursorRange = glCanvas->width() * getCursorPixelRangeMult();
pos.setX(widget->width() / 2.0f + cursorRange * xAngle);
pos.setY(widget->height() / 2.0f + cursorRange * yAngle);
pos.setX(glCanvas->width() / 2.0f + cursorRange * xAngle);
pos.setY(glCanvas->height() / 2.0f + cursorRange * yAngle);
}

View file

@ -33,10 +33,10 @@ bool TV3DManager::isConnected() {
}
void TV3DManager::connect() {
Application* app = Application::getInstance();
int width = app->getGLWidget()->getDeviceWidth();
int height = app->getGLWidget()->getDeviceHeight();
Camera& camera = *app->getCamera();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
int width = glCanvas->getDeviceWidth();
int height = glCanvas->getDeviceHeight();
Camera& camera = *Application::getInstance()->getCamera();
configureCamera(camera, width, height);
}
@ -91,7 +91,8 @@ void TV3DManager::display(Camera& whichCamera) {
// left eye portal
int portalX = 0;
int portalY = 0;
QSize deviceSize = Application::getInstance()->getGLWidget()->getDeviceSize() *
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
QSize deviceSize = glCanvas->getDeviceSize() *
Application::getInstance()->getRenderResolutionScale();
int portalW = deviceSize.width() / 2;
int portalH = deviceSize.height();

View file

@ -121,7 +121,7 @@ static const QMultiHash<QByteArray, QPair<int, float> >& getActionUnitNameMap()
const float TRANSLATION_SCALE = 20.0f;
void Visage::init() {
connect(DependencyManager::get<Faceshift>(), SIGNAL(connectionStateChanged()), SLOT(updateEnabled()));
connect(DependencyManager::get<Faceshift>().data(), SIGNAL(connectionStateChanged()), SLOT(updateEnabled()));
updateEnabled();
}

View file

@ -26,8 +26,9 @@ namespace VisageSDK {
}
/// Handles input from the Visage webcam feature tracking software.
class Visage : public FaceTracker, public DependencyManager::Dependency {
class Visage : public FaceTracker {
Q_OBJECT
SINGLETON_DEPENDENCY
public:
void init();
@ -44,7 +45,6 @@ public slots:
private:
Visage();
virtual ~Visage();
friend DependencyManager;
#ifdef HAVE_VISAGE
VisageSDK::VisageTracker2* _tracker;

View file

@ -139,15 +139,15 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
QOpenGLFramebufferObject* destFBO = toTexture ?
Application::getInstance()->getTextureCache()->getSecondaryFramebufferObject() : NULL;
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
if (!Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect) || _isEmpty) {
// copy the primary to the screen
if (destFBO && QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()) {
QOpenGLFramebufferObject::blitFramebuffer(destFBO, primaryFBO);
QOpenGLFramebufferObject::blitFramebuffer(destFBO, primaryFBO);
} else {
maybeBind(destFBO);
if (!destFBO) {
glViewport(0, 0, Application::getInstance()->getGLWidget()->getDeviceWidth(),
Application::getInstance()->getGLWidget()->getDeviceHeight());
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
glEnable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
@ -194,9 +194,7 @@ QOpenGLFramebufferObject* GlowEffect::render(bool toTexture) {
}
maybeBind(destFBO);
if (!destFBO) {
glViewport(0, 0,
Application::getInstance()->getGLWidget()->getDeviceWidth(),
Application::getInstance()->getGLWidget()->getDeviceHeight());
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
}
_addSeparateProgram->bind();
renderFullscreenQuad();

View file

@ -352,7 +352,7 @@ QSharedPointer<Resource> TextureCache::createResource(const QUrl& url,
QOpenGLFramebufferObject* TextureCache::createFramebufferObject() {
QOpenGLFramebufferObject* fbo = new QOpenGLFramebufferObject(_frameBufferSize);
Application::getInstance()->getGLWidget()->installEventFilter(this);
DependencyManager::get<GLCanvas>()->installEventFilter(this);
glBindTexture(GL_TEXTURE_2D, fbo->texture());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

View file

@ -267,9 +267,9 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) {
}
}
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
GLCanvas* widget = Application::getInstance()->getGLWidget();
return glm::vec2(widget->width(), widget->height());
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
return glm::vec2(glCanvas->width(), glCanvas->height());
}
AbstractInputController* ControllerScriptingInterface::createInputController(const QString& deviceName, const QString& tracker) {

View file

@ -40,7 +40,7 @@ WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title
}
QScriptValue WindowScriptingInterface::hasFocus() {
return Application::getInstance()->getGLWidget()->hasFocus();
return DependencyManager::get<GLCanvas>()->hasFocus();
}
void WindowScriptingInterface::setCursorVisible(bool visible) {

View file

@ -145,11 +145,11 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
Application* application = Application::getInstance();
Overlays& overlays = application->getOverlays();
GLCanvas* glWidget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
MyAvatar* myAvatar = application->getAvatar();
_textureFov = glm::radians(Menu::getInstance()->getOculusUIAngularSize());
_textureAspectRatio = (float)application->getGLWidget()->getDeviceWidth() / (float)application->getGLWidget()->getDeviceHeight();
_textureAspectRatio = (float)glCanvas->getDeviceWidth() / (float)glCanvas->getDeviceHeight();
//Handle fading and deactivation/activation of UI
if (Menu::getInstance()->isOptionChecked(MenuOption::UserInterface)) {
@ -178,12 +178,12 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
glPushMatrix(); {
glLoadIdentity();
gluOrtho2D(0, glWidget->width(), glWidget->height(), 0);
gluOrtho2D(0, glCanvas->width(), glCanvas->height(), 0);
renderAudioMeter();
if (Menu::getInstance()->isOptionChecked(MenuOption::HeadMouse)) {
myAvatar->renderHeadMouse(glWidget->width(), glWidget->height());
myAvatar->renderHeadMouse(glCanvas->width(), glCanvas->height());
}
renderStatsAndLogs();
@ -213,7 +213,7 @@ void ApplicationOverlay::displayOverlayTexture() {
if (_alpha == 0.0f) {
return;
}
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
@ -222,16 +222,16 @@ void ApplicationOverlay::displayOverlayTexture() {
glMatrixMode(GL_PROJECTION);
glPushMatrix(); {
glLoadIdentity();
gluOrtho2D(0, glWidget->getDeviceWidth(), glWidget->getDeviceHeight(), 0);
gluOrtho2D(0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight(), 0);
glDisable(GL_DEPTH_TEST);
glDisable(GL_LIGHTING);
glEnable(GL_BLEND);
glBegin(GL_QUADS); {
glColor4f(1.0f, 1.0f, 1.0f, _alpha);
glTexCoord2f(0, 0); glVertex2i(0, glWidget->getDeviceHeight());
glTexCoord2f(1, 0); glVertex2i(glWidget->getDeviceWidth(), glWidget->getDeviceHeight());
glTexCoord2f(1, 1); glVertex2i(glWidget->getDeviceWidth(), 0);
glTexCoord2f(0, 0); glVertex2i(0, glCanvas->getDeviceHeight());
glTexCoord2f(1, 0); glVertex2i(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
glTexCoord2f(1, 1); glVertex2i(glCanvas->getDeviceWidth(), 0);
glTexCoord2f(0, 1); glVertex2i(0, 0);
} glEnd();
} glPopMatrix();
@ -378,18 +378,19 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
glEnd();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
if (_crosshairTexture == 0) {
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
_crosshairTexture = glCanvas->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
}
//draw the mouse pointer
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
const float reticleSize = 40.0f / application->getGLWidget()->width() * quadWidth;
const float reticleSize = 40.0f / glCanvas->width() * quadWidth;
x -= reticleSize / 2.0f;
y += reticleSize / 2.0f;
const float mouseX = (application->getMouseX() / (float)application->getGLWidget()->width()) * quadWidth;
const float mouseY = (1.0 - (application->getMouseY() / (float)application->getGLWidget()->height())) * quadHeight;
const float mouseX = (application->getMouseX() / (float)glCanvas->width()) * quadWidth;
const float mouseY = (1.0 - (application->getMouseY() / (float)glCanvas->height())) * quadHeight;
glBegin(GL_QUADS);
@ -431,7 +432,7 @@ void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origi
//Caculate the click location using one of the sixense controllers. Scale is not applied
QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
Application* application = Application::getInstance();
GLCanvas* glWidget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
MyAvatar* myAvatar = application->getAvatar();
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
@ -462,8 +463,8 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
float u = asin(collisionPos.x) / (_textureFov)+0.5f;
float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f);
rv.setX(u * glWidget->width());
rv.setY(v * glWidget->height());
rv.setX(u * glCanvas->width());
rv.setY(v * glCanvas->height());
}
} else {
//if they did not click on the overlay, just set the coords to INT_MAX
@ -480,8 +481,8 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
ndcSpacePos = glm::vec3(clipSpacePos) / clipSpacePos.w;
}
rv.setX(((ndcSpacePos.x + 1.0) / 2.0) * glWidget->width());
rv.setY((1.0 - ((ndcSpacePos.y + 1.0) / 2.0)) * glWidget->height());
rv.setX(((ndcSpacePos.x + 1.0) / 2.0) * glCanvas->width());
rv.setY((1.0 - ((ndcSpacePos.y + 1.0) / 2.0)) * glCanvas->height());
}
return rv;
}
@ -510,10 +511,11 @@ bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position,
//Renders optional pointers
void ApplicationOverlay::renderPointers() {
Application* application = Application::getInstance();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
//lazily load crosshair texture
if (_crosshairTexture == 0) {
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
_crosshairTexture = glCanvas->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
}
glEnable(GL_TEXTURE_2D);
@ -536,7 +538,7 @@ void ApplicationOverlay::renderPointers() {
glm::vec2 screenPos = sphericalToScreen(glm::vec2(yaw, -pitch));
position = QPoint(screenPos.x, screenPos.y);
application->getGLWidget()->cursor().setPos(application->getGLWidget()->mapToGlobal(position));
glCanvas->cursor().setPos(glCanvas->mapToGlobal(position));
}
_reticlePosition[MOUSE] = position;
@ -557,7 +559,7 @@ void ApplicationOverlay::renderPointers() {
void ApplicationOverlay::renderControllerPointers() {
Application* application = Application::getInstance();
GLCanvas* glWidget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
MyAvatar* myAvatar = application->getAvatar();
//Static variables used for storing controller state
@ -635,14 +637,14 @@ void ApplicationOverlay::renderControllerPointers() {
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
// Get the pixel range over which the xAngle and yAngle are scaled
float cursorRange = glWidget->width() * SixenseManager::getInstance().getCursorPixelRangeMult();
float cursorRange = glCanvas->width() * SixenseManager::getInstance().getCursorPixelRangeMult();
mouseX = (glWidget->width() / 2.0f + cursorRange * xAngle);
mouseY = (glWidget->height() / 2.0f + cursorRange * yAngle);
mouseX = (glCanvas->width() / 2.0f + cursorRange * xAngle);
mouseY = (glCanvas->height() / 2.0f + cursorRange * yAngle);
}
//If the cursor is out of the screen then don't render it
if (mouseX < 0 || mouseX >= glWidget->width() || mouseY < 0 || mouseY >= glWidget->height()) {
if (mouseX < 0 || mouseX >= glCanvas->width() || mouseY < 0 || mouseY >= glCanvas->height()) {
_reticleActive[index] = false;
continue;
}
@ -702,11 +704,10 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) {
//Renders a small magnification of the currently bound texture at the coordinates
void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool showBorder) const {
Application* application = Application::getInstance();
GLCanvas* glWidget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
const int widgetWidth = glWidget->width();
const int widgetHeight = glWidget->height();
const int widgetWidth = glCanvas->width();
const int widgetHeight = glCanvas->height();
const float halfWidth = (MAGNIFY_WIDTH / _textureAspectRatio) * sizeMult / 2.0f;
const float halfHeight = MAGNIFY_HEIGHT * sizeMult / 2.0f;
@ -760,8 +761,8 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
void ApplicationOverlay::renderAudioMeter() {
Application* application = Application::getInstance();
GLCanvas* glWidget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
Audio* audio = application->getAudio();
// Display a single screen-size quad to create an alpha blended 'collision' flash
@ -769,7 +770,7 @@ void ApplicationOverlay::renderAudioMeter() {
float collisionSoundMagnitude = audio->getCollisionSoundMagnitude();
const float VISIBLE_COLLISION_SOUND_MAGNITUDE = 0.5f;
if (collisionSoundMagnitude > VISIBLE_COLLISION_SOUND_MAGNITUDE) {
renderCollisionOverlay(glWidget->width(), glWidget->height(),
renderCollisionOverlay(glCanvas->width(), glCanvas->height(),
audio->getCollisionSoundMagnitude());
}
}
@ -823,14 +824,14 @@ void ApplicationOverlay::renderAudioMeter() {
if ((audio->getTimeSinceLastClip() > 0.0f) && (audio->getTimeSinceLastClip() < CLIPPING_INDICATOR_TIME)) {
const float MAX_MAGNITUDE = 0.7f;
float magnitude = MAX_MAGNITUDE * (1 - audio->getTimeSinceLastClip() / CLIPPING_INDICATOR_TIME);
renderCollisionOverlay(glWidget->width(), glWidget->height(), magnitude, 1.0f);
renderCollisionOverlay(glCanvas->width(), glCanvas->height(), magnitude, 1.0f);
}
audio->renderToolBox(MIRROR_VIEW_LEFT_PADDING + AUDIO_METER_GAP, audioMeterY, boxed);
audio->renderScope(glWidget->width(), glWidget->height());
audio->renderScope(glCanvas->width(), glCanvas->height());
audio->renderStats(WHITE_TEXT, glWidget->width(), glWidget->height());
audio->renderStats(WHITE_TEXT, glCanvas->width(), glCanvas->height());
glBegin(GL_QUADS);
if (isClipping) {
@ -891,8 +892,8 @@ void ApplicationOverlay::renderAudioMeter() {
void ApplicationOverlay::renderStatsAndLogs() {
Application* application = Application::getInstance();
GLCanvas* glWidget = application->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
BandwidthMeter* bandwidthMeter = application->getBandwidthMeter();
NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay();
@ -910,8 +911,8 @@ void ApplicationOverlay::renderStatsAndLogs() {
application->getPacketsPerSecond(), application->getBytesPerSecond(), voxelPacketsToProcess);
// Bandwidth meter
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth)) {
Stats::drawBackground(0x33333399, glWidget->width() - 296, glWidget->height() - 68, 296, 68);
bandwidthMeter->render(glWidget->width(), glWidget->height());
Stats::drawBackground(0x33333399, glCanvas->width() - 296, glCanvas->height() - 68, 296, 68);
bandwidthMeter->render(glCanvas->width(), glCanvas->height());
}
}
@ -924,7 +925,7 @@ void ApplicationOverlay::renderStatsAndLogs() {
(Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth))
? 80 : 20;
drawText(glWidget->width() - 100, glWidget->height() - timerBottom,
drawText(glCanvas->width() - 100, glCanvas->height() - timerBottom,
0.30f, 0.0f, 0, frameTimer, WHITE_TEXT);
}
nodeBoundsDisplay.drawOverlay();
@ -934,9 +935,9 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder() {
NodeList* nodeList = NodeList::getInstance();
if (nodeList && !nodeList->getDomainHandler().isConnected()) {
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
int right = glWidget->width();
int bottom = glWidget->height();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
int right = glCanvas->width();
int bottom = glCanvas->height();
glColor3f(CONNECTION_STATUS_BORDER_COLOR[0],
CONNECTION_STATUS_BORDER_COLOR[1],
@ -1071,7 +1072,7 @@ void ApplicationOverlay::TexturedHemisphere::cleanupVBO() {
}
void ApplicationOverlay::TexturedHemisphere::buildFramebufferObject() {
QSize size = Application::getInstance()->getGLWidget()->getDeviceSize();
QSize size = DependencyManager::get<GLCanvas>()->getDeviceSize();
if (_framebufferObject != NULL && size == _framebufferObject->size()) {
// Already build
return;
@ -1122,7 +1123,7 @@ void ApplicationOverlay::TexturedHemisphere::render() {
glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
float yaw = -(screenPos.x / screenSize.width() - 0.5f) * MOUSE_YAW_RANGE;
float pitch = (screenPos.y / screenSize.height() - 0.5f) * MOUSE_PITCH_RANGE;
@ -1130,7 +1131,7 @@ glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
}
glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
float x = (-sphericalPos.x / MOUSE_YAW_RANGE + 0.5f) * screenSize.width();
float y = (sphericalPos.y / MOUSE_PITCH_RANGE + 0.5f) * screenSize.height();
@ -1138,7 +1139,7 @@ glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
}
glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
float x = (-sphericalPos.x / (_textureFov * _textureAspectRatio) + 0.5f) * screenSize.width();
float y = (sphericalPos.y / _textureFov + 0.5f) * screenSize.height();
@ -1146,7 +1147,7 @@ glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
}
glm::vec2 ApplicationOverlay::overlayToSpherical(glm::vec2 overlayPos) const {
QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize();
float yaw = -(overlayPos.x / screenSize.width() - 0.5f) * _textureFov * _textureAspectRatio;
float pitch = (overlayPos.y / screenSize.height() - 0.5f) * _textureFov;

View file

@ -138,7 +138,7 @@ MetavoxelEditor::MetavoxelEditor() :
connect(Application::getInstance()->getMetavoxels(), &MetavoxelSystem::rendering,
this, &MetavoxelEditor::renderPreview);
Application::getInstance()->getGLWidget()->installEventFilter(this);
DependencyManager::get<GLCanvas>()->installEventFilter(this);
show();

View file

@ -21,7 +21,7 @@
const int BYTES_PER_KILOBYTE = 1024;
MetavoxelNetworkSimulator::MetavoxelNetworkSimulator() :
QWidget(Application::getInstance()->getGLWidget(), Qt::Dialog) {
QWidget(DependencyManager::get<GLCanvas>().data(), Qt::Dialog) {
setWindowTitle("Metavoxel Network Simulator");
setAttribute(Qt::WA_DeleteOnClose);

View file

@ -215,8 +215,8 @@ void PreferencesDialog::savePreferences() {
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
Application::getInstance()->getVoxels()->setMaxVoxels(ui.maxVoxelsSpin->value());
Application::getInstance()->resizeGL(Application::getInstance()->getGLWidget()->width(),
Application::getInstance()->getGLWidget()->height());
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
Menu::getInstance()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());
@ -248,8 +248,7 @@ void PreferencesDialog::savePreferences() {
Menu::getInstance()->setReceivedAudioStreamSettings(streamSettings);
Application::getInstance()->getAudio()->setReceivedAudioStreamSettings(streamSettings);
Application::getInstance()->resizeGL(Application::getInstance()->getGLWidget()->width(),
Application::getInstance()->getGLWidget()->height());
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
Application::getInstance()->bumpSettings();
}

View file

@ -83,9 +83,8 @@ QTemporaryFile* Snapshot::saveTempSnapshot() {
}
QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
QGLWidget* widget = Application::getInstance()->getGLWidget();
QImage shot = widget->grabFrameBuffer();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
QImage shot = glCanvas->grabFrameBuffer();
Avatar* avatar = Application::getInstance()->getAvatar();

View file

@ -56,8 +56,8 @@ Stats::Stats():
_metavoxelReceiveProgress(0),
_metavoxelReceiveTotal(0)
{
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
resetWidth(glWidget->width(), 0);
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
resetWidth(glCanvas->width(), 0);
}
void Stats::toggleExpanded() {
@ -67,7 +67,7 @@ void Stats::toggleExpanded() {
// called on mouse click release
// check for clicks over stats in order to expand or contract them
void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) {
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) {
// not worried about dragging on stats
@ -114,7 +114,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
// top-right stats click
lines = _expanded ? 11 : 3;
statsHeight = lines * STATS_PELS_PER_LINE + 10;
statsWidth = glWidget->width() - statsX;
statsWidth = glCanvas->width() - statsX;
if (mouseX > statsX && mouseX < statsX + statsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
toggleExpanded();
return;
@ -122,8 +122,8 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
}
void Stats::resetWidth(int width, int horizontalOffset) {
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
int extraSpace = glWidget->width() - horizontalOffset -2
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
int extraSpace = glCanvas->width() - horizontalOffset -2
- STATS_GENERAL_MIN_WIDTH
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
- STATS_GEO_MIN_WIDTH
@ -147,7 +147,7 @@ void Stats::resetWidth(int width, int horizontalOffset) {
_pingStatsWidth += (int) extraSpace / panels;
}
_geoStatsWidth += (int) extraSpace / panels;
_voxelStatsWidth += glWidget->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
_voxelStatsWidth += glCanvas->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
}
}
@ -198,7 +198,7 @@ void Stats::display(
int bytesPerSecond,
int voxelPacketsToProcess)
{
GLCanvas* glWidget = Application::getInstance()->getGLWidget();
QSharedPointer<GLCanvas> glCanvas = DependencyManager::get<GLCanvas>();
unsigned int backgroundColor = 0x33333399;
int verticalOffset = 0, lines = 0;
@ -210,7 +210,7 @@ void Stats::display(
std::stringstream voxelStats;
if (_lastHorizontalOffset != horizontalOffset) {
resetWidth(glWidget->width(), horizontalOffset);
resetWidth(glCanvas->width(), horizontalOffset);
_lastHorizontalOffset = horizontalOffset;
}
@ -478,7 +478,7 @@ void Stats::display(
lines = _expanded ? 14 : 3;
drawBackground(backgroundColor, horizontalOffset, 0, glWidget->width() - horizontalOffset,
drawBackground(backgroundColor, horizontalOffset, 0, glCanvas->width() - horizontalOffset,
lines * STATS_PELS_PER_LINE + 10);
horizontalOffset += 5;