diff --git a/doomsday/client/include/ui/widgets/guirootwidget.h b/doomsday/client/include/ui/widgets/guirootwidget.h index 8d2a06101e..eb0cb42af7 100644 --- a/doomsday/client/include/ui/widgets/guirootwidget.h +++ b/doomsday/client/include/ui/widgets/guirootwidget.h @@ -22,6 +22,7 @@ #include #include #include +#include class ClientWindow; @@ -49,6 +50,11 @@ class GuiRootWidget : public de::RootWidget de::AtlasTexture &atlas(); de::GLShaderBank &shaders(); + /** + * Returns the default projection for 2D graphics. + */ + de::Matrix4f projMatrix2D() const; + // Events. void update(); diff --git a/doomsday/client/src/ui/widgets/guirootwidget.cpp b/doomsday/client/src/ui/widgets/guirootwidget.cpp index 57284ae469..3ebbf4001b 100644 --- a/doomsday/client/src/ui/widgets/guirootwidget.cpp +++ b/doomsday/client/src/ui/widgets/guirootwidget.cpp @@ -35,6 +35,14 @@ DENG2_PIMPL(GuiRootWidget) window(win), atlas(0) {} + + ~Instance() + { + // Tell all widgets to release their resource allocations. The base + // class destructor will destroy all widgets, but this class governs + // shared GL resources, so we'll ask the widgets to do this now. + self.notifyTree(&Widget::deinitialize); + } }; GuiRootWidget::GuiRootWidget(ClientWindow *window) @@ -58,7 +66,7 @@ AtlasTexture &GuiRootWidget::atlas() { d->atlas.reset(AtlasTexture::newWithRowAllocator( Atlas::BackingStore | Atlas::AllowDefragment, - GLTexture::maximumSize())); + GLTexture::maximumSize().min(GLTexture::Size(4096, 4096)))); } return *d->atlas; } @@ -68,6 +76,12 @@ GLShaderBank &GuiRootWidget::shaders() return ClientApp::glShaderBank(); } +Matrix4f GuiRootWidget::projMatrix2D() const +{ + RootWidget::Size const size = viewSize(); + return Matrix4f::ortho(0, size.x, 0, size.y); +} + void GuiRootWidget::update() { // Allow GL operations.