diff --git a/include/Spectre/Display/GLContext.h b/include/Spectre/Display/GLContext.h index 9f2acba..837d629 100644 --- a/include/Spectre/Display/GLContext.h +++ b/include/Spectre/Display/GLContext.h @@ -38,9 +38,6 @@ public : // This is usually refered to as enabling/disabling vertical synchronization. virtual bool setSwapInterval(int interval) = 0; - // Set the size of the pixel buffer. - virtual void setSize(unsigned int width, unsigned int height) = 0; - // Swap front with back buffer and vice versa. virtual void swapBuffers() = 0; }; diff --git a/source/Display/Display.cpp b/source/Display/Display.cpp index c86f21f..2d57402 100644 --- a/source/Display/Display.cpp +++ b/source/Display/Display.cpp @@ -5,6 +5,8 @@ #include #include +#include + namespace sp { #define CAPTION_DEFAULT "Spectre" @@ -182,8 +184,12 @@ void Display::swapBuffers() void Display::onReshape(int width, int height) { - // Resize context if the windows resizes. - m_context->setSize(width, height); + // TODO: This should even not be here. + // Generic Display should not have any GL calls. + // But it's better to have it here then in the platform specific GLContext + if (activate(true)) { + glViewport(0, 0, width, height); + } } } // namespace sp diff --git a/source/Platform/Unix/GLXContext.cpp b/source/Platform/Unix/GLXContext.cpp index 74b6700..0fee7bc 100644 --- a/source/Platform/Unix/GLXContext.cpp +++ b/source/Platform/Unix/GLXContext.cpp @@ -189,19 +189,6 @@ bool GLXContext::setSwapInterval(int interval) return false; } -void GLXContext::setSize(unsigned int width, unsigned int height) -{ - // TODO: Not GLX specific! move to generic GLContext class. - if (activate()) { - glViewport(0, 0, width, height); - } -} - -void GLXContext::setSize(const Vector2u size) -{ - setSize(size.x, size.y); -} - void GLXContext::swapBuffers() { glXSwapBuffers(Xlib::getDisplay(), m_win); diff --git a/source/Platform/Unix/GLXContext.h b/source/Platform/Unix/GLXContext.h index 65d940b..7941e5b 100644 --- a/source/Platform/Unix/GLXContext.h +++ b/source/Platform/Unix/GLXContext.h @@ -28,10 +28,6 @@ public : bool setSwapInterval(int interval); - void setSize(unsigned int width, unsigned int height); - - void setSize(const Vector2u size); - void swapBuffers(); private : diff --git a/source/Platform/Win32/Win32GLContext.cpp b/source/Platform/Win32/Win32GLContext.cpp index 475394a..c9b1c25 100644 --- a/source/Platform/Win32/Win32GLContext.cpp +++ b/source/Platform/Win32/Win32GLContext.cpp @@ -149,13 +149,6 @@ bool Win32GLContext::setSwapInterval(int interval) return wglSwapIntervalEXT(interval); } -void Win32GLContext::setSize(unsigned int width, unsigned int height) -{ - if (activate()) { - glViewport(0, 0, width, height); - } -} - void Win32GLContext::swapBuffers() { if (m_deviceContext) { diff --git a/source/Platform/Win32/Win32GLContext.h b/source/Platform/Win32/Win32GLContext.h index 6525c1e..b91807e 100644 --- a/source/Platform/Win32/Win32GLContext.h +++ b/source/Platform/Win32/Win32GLContext.h @@ -28,10 +28,6 @@ public : bool setSwapInterval(int interval); - void setSize(unsigned int width, unsigned int height); - - void setSize(const Vector2u size); - void swapBuffers(); private :