From 25708678f6eed2ed69b6dbaaac358fb30bb0b0e0 Mon Sep 17 00:00:00 2001 From: Bing Shearer Date: Thu, 9 Jul 2015 14:18:53 -0700 Subject: [PATCH 1/3] Fixed shutdown procedure for Datagrams so that there is no crash on exit --- interface/src/DatagramProcessor.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/src/DatagramProcessor.cpp b/interface/src/DatagramProcessor.cpp index f691527186..99308a922f 100644 --- a/interface/src/DatagramProcessor.cpp +++ b/interface/src/DatagramProcessor.cpp @@ -29,12 +29,13 @@ DatagramProcessor::DatagramProcessor(QObject* parent) : } void DatagramProcessor::processDatagrams() { - PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), - "DatagramProcessor::processDatagrams()"); if (_isShuttingDown) { return; // bail early... we're shutting down. } + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "DatagramProcessor::processDatagrams()"); + HifiSockAddr senderSockAddr; From 85f6fdb8cfedd09f73fc66de9223df983b8c1de2 Mon Sep 17 00:00:00 2001 From: Bing Shearer Date: Thu, 9 Jul 2015 14:20:10 -0700 Subject: [PATCH 2/3] Fixed bug which would cause program to crash if there was no image associated with an overlay in windows build (see checkbox in sunLightExample) --- interface/src/ui/overlays/ImageOverlay.cpp | 67 +++++++++++----------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/interface/src/ui/overlays/ImageOverlay.cpp b/interface/src/ui/overlays/ImageOverlay.cpp index 399e8a459a..e80c6f584b 100644 --- a/interface/src/ui/overlays/ImageOverlay.cpp +++ b/interface/src/ui/overlays/ImageOverlay.cpp @@ -75,46 +75,49 @@ void ImageOverlay::render(RenderArgs* args) { glm::vec2 topLeft(left, top); glm::vec2 bottomRight(right, bottom); - float imageWidth = _texture->getWidth(); - float imageHeight = _texture->getHeight(); + // if for some reason our image is not over 0 width or height, don't attempt to render the image - if (_renderImage && imageWidth > 0 && imageHeight > 0) { + if (_renderImage) { + float imageWidth = _texture->getWidth(); + float imageHeight = _texture->getHeight(); + if (imageWidth > 0 && imageHeight > 0) { + QRect fromImage; + if (_wantClipFromImage) { + float scaleX = imageWidth / _texture->getOriginalWidth(); + float scaleY = imageHeight / _texture->getOriginalHeight(); - QRect fromImage; - if (_wantClipFromImage) { - float scaleX = imageWidth / _texture->getOriginalWidth(); - float scaleY = imageHeight / _texture->getOriginalHeight(); + fromImage.setX(scaleX * _fromImage.x()); + fromImage.setY(scaleY * _fromImage.y()); + fromImage.setWidth(scaleX * _fromImage.width()); + fromImage.setHeight(scaleY * _fromImage.height()); + } + else { + fromImage.setX(0); + fromImage.setY(0); + fromImage.setWidth(imageWidth); + fromImage.setHeight(imageHeight); + } - fromImage.setX(scaleX * _fromImage.x()); - fromImage.setY(scaleY * _fromImage.y()); - fromImage.setWidth(scaleX * _fromImage.width()); - fromImage.setHeight(scaleY * _fromImage.height()); - } else { - fromImage.setX(0); - fromImage.setY(0); - fromImage.setWidth(imageWidth); - fromImage.setHeight(imageHeight); + float x = fromImage.x() / imageWidth; + float y = fromImage.y() / imageHeight; + float w = fromImage.width() / imageWidth; // ?? is this what we want? not sure + float h = fromImage.height() / imageHeight; + + glm::vec2 texCoordTopLeft(x, y); + glm::vec2 texCoordBottomRight(x + w, y + h); + + DependencyManager::get()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor); + } + else { + DependencyManager::get()->renderQuad(topLeft, bottomRight, quadColor); } - float x = fromImage.x() / imageWidth; - float y = fromImage.y() / imageHeight; - float w = fromImage.width() / imageWidth; // ?? is this what we want? not sure - float h = fromImage.height() / imageHeight; - - glm::vec2 texCoordTopLeft(x, y); - glm::vec2 texCoordBottomRight(x + w, y + h); - - DependencyManager::get()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor); - } else { - DependencyManager::get()->renderQuad(topLeft, bottomRight, quadColor); - } - - if (_renderImage) { - glDisable(GL_TEXTURE_2D); + if (_renderImage) { + glDisable(GL_TEXTURE_2D); + } } } - void ImageOverlay::setProperties(const QScriptValue& properties) { Overlay2D::setProperties(properties); From 99c563602f34349614b409e7b96e6663213485d6 Mon Sep 17 00:00:00 2001 From: Bing Shearer Date: Thu, 9 Jul 2015 15:25:37 -0700 Subject: [PATCH 3/3] Fixed Else case where _renderImage is true but the texture has 0 size, else case did not previously exist. --- interface/src/ui/overlays/ImageOverlay.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/interface/src/ui/overlays/ImageOverlay.cpp b/interface/src/ui/overlays/ImageOverlay.cpp index e80c6f584b..7a0c3c00c3 100644 --- a/interface/src/ui/overlays/ImageOverlay.cpp +++ b/interface/src/ui/overlays/ImageOverlay.cpp @@ -75,8 +75,6 @@ void ImageOverlay::render(RenderArgs* args) { glm::vec2 topLeft(left, top); glm::vec2 bottomRight(right, bottom); - - // if for some reason our image is not over 0 width or height, don't attempt to render the image if (_renderImage) { float imageWidth = _texture->getWidth(); @@ -108,16 +106,15 @@ void ImageOverlay::render(RenderArgs* args) { glm::vec2 texCoordBottomRight(x + w, y + h); DependencyManager::get()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor); - } - else { + } else { DependencyManager::get()->renderQuad(topLeft, bottomRight, quadColor); } - - if (_renderImage) { - glDisable(GL_TEXTURE_2D); - } + glDisable(GL_TEXTURE_2D); + } else { + DependencyManager::get()->renderQuad(topLeft, bottomRight, quadColor); } } + void ImageOverlay::setProperties(const QScriptValue& properties) { Overlay2D::setProperties(properties);