From 4cd2d0926a7a5136c55b35bd58ca53a2f37d935e Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 25 Sep 2016 15:53:53 +0300 Subject: [PATCH] Fix TextureMappingState::draw(), surfaces moving along with the texture --- src/Application/States/TextureMappingState.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Application/States/TextureMappingState.cpp b/src/Application/States/TextureMappingState.cpp index af21910..7520f49 100644 --- a/src/Application/States/TextureMappingState.cpp +++ b/src/Application/States/TextureMappingState.cpp @@ -29,16 +29,26 @@ void TextureMappingState::draw(Application * app){ if(_drawMode == 0){ // Semi-transparent surfaces on front drawTexture(app); + ofPopMatrix(); + ofPushStyle(); ofSetColor(255, 255, 255, 150); app->getSurfaceManager()->draw(); ofPopStyle(); + + ofPushMatrix(); + ofTranslate(_canvasTranslate.x, _canvasTranslate.y); }else if(_drawMode == 1){ // Opaque surfaces on front drawTexture(app); + ofPopMatrix(); + ofPushStyle(); ofSetColor(255, 255, 255, 255); app->getSurfaceManager()->draw(); ofPopStyle(); + + ofPushMatrix(); + ofTranslate(_canvasTranslate.x, _canvasTranslate.y); }else if(_drawMode == 2){ // Draw texture only ofTranslate(_canvasTranslate.x, _canvasTranslate.y); drawTexture(app); @@ -47,8 +57,13 @@ void TextureMappingState::draw(Application * app){ } if(_drawMode != 2){ + ofPopMatrix(); + Gui::instance()->getSurfaceHighlightWidget().setSurfaceManager(app->getSurfaceManager()); Gui::instance()->getSurfaceHighlightWidget().draw(); + + ofPushMatrix(); + ofTranslate(_canvasTranslate.x, _canvasTranslate.y); } Gui::instance()->getTextureHighlightWidget().setSurfaceManager(app->getSurfaceManager());