GLContext: remove setSize() and set glViewport() in Display::onReshape()
This commit is contained in:
parent
60333f6d02
commit
c1f1dd75bd
6 changed files with 8 additions and 33 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include <Spectre/Graphics/Image.h>
|
||||
#include <Platform/PlatformDisplay.h>
|
||||
|
||||
#include <Graphics/GL/gl.h>
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 :
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue