diff --git a/src/eepp/graphics/framebuffer.cpp b/src/eepp/graphics/framebuffer.cpp index c4e0fcbfd..686ba2282 100644 --- a/src/eepp/graphics/framebuffer.cpp +++ b/src/eepp/graphics/framebuffer.cpp @@ -55,7 +55,7 @@ ColorAf FrameBuffer::getClearColor() const { void FrameBuffer::clear() { GLi->clearColor( mClearColor.r, mClearColor.g, mClearColor.b, mClearColor.a ); - GLi->clear( GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + GLi->clear( GL_COLOR_BUFFER_BIT | ( mHasDepthBuffer ? GL_DEPTH_BUFFER_BIT : 0 ) ); mWindow->setClearColor( mWindow->getClearColor() ); } diff --git a/src/eepp/graphics/renderer/clippingmask.cpp b/src/eepp/graphics/renderer/clippingmask.cpp index 506a52abd..1b393d2f8 100644 --- a/src/eepp/graphics/renderer/clippingmask.cpp +++ b/src/eepp/graphics/renderer/clippingmask.cpp @@ -124,6 +124,7 @@ void ClippingMask::stencilMaskEnable() { GLi->stencilMask(0xFF); GLi->stencilFunc(GL_NEVER, 1, 0xFF); GLi->stencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); + GLi->clear(GL_STENCIL_BUFFER_BIT); drawMask(); diff --git a/src/eepp/maps/mapeditor/uimap.cpp b/src/eepp/maps/mapeditor/uimap.cpp index b04bc036d..4ea2d2ba6 100644 --- a/src/eepp/maps/mapeditor/uimap.cpp +++ b/src/eepp/maps/mapeditor/uimap.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -100,6 +101,8 @@ void UIMap::update() { UIWidget::update(); if ( NULL != mMap ) { + invalidateDraw(); + mMap->update(); if ( mEnabled && mVisible && isMouseOver() ) { diff --git a/src/eepp/maps/tilemap.cpp b/src/eepp/maps/tilemap.cpp index 79005904f..55129ed34 100644 --- a/src/eepp/maps/tilemap.cpp +++ b/src/eepp/maps/tilemap.cpp @@ -214,7 +214,7 @@ void TileMap::draw() { GlobalBatchRenderer::instance()->draw(); if ( getClipedArea() ) { - GLi->getClippingMask()->clipEnable( mScreenPos.x, mScreenPos.y, mViewSize.x, mViewSize.y ); + GLi->getClippingMask()->clipPlaneEnable( mScreenPos.x, mScreenPos.y, mViewSize.x, mViewSize.y ); } if ( getDrawBackground() ) { @@ -227,9 +227,6 @@ void TileMap::draw() { P.setColor( Color( 255, 255, 255, 255 ) ); } - float oldM[16]; - GLi->getCurrentMatrix( GL_MODELVIEW_MATRIX, oldM ); - GLi->loadIdentity(); GLi->pushMatrix(); GLi->translatef( (Float)static_cast( mScreenPos.x + mOffset.x ), (Float)static_cast( mScreenPos.y + mOffset.y ), 0 ); GLi->scalef( mScale, mScale, 0 ); @@ -249,10 +246,9 @@ void TileMap::draw() { GlobalBatchRenderer::instance()->draw(); GLi->popMatrix(); - GLi->loadMatrixf( oldM ); if ( getClipedArea() ) { - GLi->getClippingMask()->clipDisable(); + GLi->getClippingMask()->clipPlaneDisable(); } } diff --git a/src/eepp/ui/uiwindow.cpp b/src/eepp/ui/uiwindow.cpp index 65e55af6a..d9d259316 100644 --- a/src/eepp/ui/uiwindow.cpp +++ b/src/eepp/ui/uiwindow.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -1075,6 +1076,8 @@ void UIWindow::matrixSet() { void UIWindow::matrixUnset() { if ( ownsFrameBuffer() ) { + GlobalBatchRenderer::instance()->draw(); + GLi->translatef( mScreenPos.x , mScreenPos.y, 0.f ); mFrameBuffer->unbind(); diff --git a/src/test/eetest.cpp b/src/test/eetest.cpp index c97f7fcbe..4e6c03a23 100644 --- a/src/test/eetest.cpp +++ b/src/test/eetest.cpp @@ -296,7 +296,7 @@ void EETest::createUI() { Uint32 UI_MAN_OPS = 0; if ( mDebugUI ) UI_MAN_OPS = UI_MANAGER_HIGHLIGHT_FOCUS | UI_MANAGER_HIGHLIGHT_OVER | UI_MANAGER_DRAW_DEBUG_DATA | UI_MANAGER_DRAW_BOXES; - UIManager::instance()->init(UI_MAN_OPS); + UIManager::instance()->init(UI_MAN_OPS | UI_MANAGER_USE_DRAW_INVALIDATION); UIManager::instance()->setTranslator( mTranslator ); //mTheme = UITheme::loadFromFile( UIThemeDefault::New( mThemeName, mThemeName ), MyPath + "ui/" + mThemeName + "/" ); @@ -848,7 +848,7 @@ static void onWinDragStop( const UIEvent * event ) { void EETest::createDecoratedWindow() { mUIWindow = UIWindow::New(); - mUIWindow->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_SHADOW /*| UI_WIN_FRAME_BUFFER*/ ) + mUIWindow->setWinFlags( UI_WIN_DEFAULT_FLAGS | UI_WIN_MAXIMIZE_BUTTON | UI_WIN_SHADOW | UI_WIN_FRAME_BUFFER ) ->setMinWindowSize( 530, 350 )->setPosition( 200, 50 ); mUIWindow->addEventListener( UIEvent::OnWindowCloseClick, cb::Make1( this, &EETest::onCloseClick ) );