More resizing

This commit is contained in:
James Grogan 2022-11-14 15:31:38 +00:00
parent 9ade0e2d4b
commit be94bf0185
11 changed files with 44 additions and 3 deletions

View file

@ -34,6 +34,11 @@ public:
void clear();
void onResize(unsigned width, unsigned height)
{
}
private:
void initialize();

View file

@ -2,6 +2,7 @@
#include "XcbGlInterface.h"
#include "FileLogger.h"
#include <iostream>
#include <GL/gl.h>
@ -56,6 +57,11 @@ bool XcbGlWindowInterface::initialize(xcb_window_t window)
return true;
}
void XcbGlWindowInterface::resizeViewPort(unsigned width, unsigned height)
{
glViewport(0, 0, width, height);
}
void XcbGlWindowInterface::destroyWindow()
{
glXDestroyWindow(mGlInterface->getDisplay(), mWindow);

View file

@ -16,6 +16,8 @@ public:
void afterPaint();
void resizeViewPort(unsigned width, unsigned height);
private:
void destroyWindow();
void swapBuffers();

View file

@ -112,3 +112,11 @@ void XcbWindow::map()
xcb_map_window(mConnection, mHandle);
xcb_flush(mConnection);
}
void XcbWindow::onResize(unsigned width, unsigned height)
{
if (mGlInterface)
{
mGlInterface->resizeViewPort(width, height);
}
}

View file

@ -34,6 +34,8 @@ public:
void map() override;
void onResize(unsigned width, unsigned height) override;
private:
int mHandle{-1};
unsigned mGraphicsContext {0};