summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-12-31 20:19:33 +0000
committerCarl Hetherington <cth@carlh.net>2019-05-06 21:31:09 +0100
commit86f2d59536e17257bc85ad60c08ede18ab7d701c (patch)
tree5e17f8ae1c0d314c26c377daf6f7b106d6845805
parent64a4b0734c282e2b07e15bf9fbf9114f723088d1 (diff)
Tweaks.
-rw-r--r--hacks/gl.cc25
1 files changed, 16 insertions, 9 deletions
diff --git a/hacks/gl.cc b/hacks/gl.cc
index 5487d35bf..8c2029cd0 100644
--- a/hacks/gl.cc
+++ b/hacks/gl.cc
@@ -13,6 +13,7 @@ public:
private:
void paint (wxPaintEvent& event);
+ void sized ();
wxGLContext* _context;
};
@@ -22,6 +23,7 @@ GLView::GLView(wxFrame *parent)
{
_context = new wxGLContext (this);
Bind (wxEVT_PAINT, boost::bind(&GLView::paint, this, _1));
+ Bind (wxEVT_SIZE, boost::bind(&GLView::sized, this));
}
GLView::~GLView ()
@@ -46,7 +48,20 @@ check_gl_error (char const * last)
}
}
-void GLView::paint (wxPaintEvent &)
+void
+GLView::sized ()
+{
+ glViewport (0, 0, GetSize().x, GetSize().y);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+ glOrtho (0, GetSize().x, GetSize().y, 0, -1, 1);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+}
+
+void
+GLView::paint (wxPaintEvent &)
{
SetCurrent (*_context);
wxPaintDC (this);
@@ -57,14 +72,6 @@ void GLView::paint (wxPaintEvent &)
glDisable(GL_DEPTH_TEST);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glViewport (0, 0, GetSize().x, GetSize().y);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
-
- glOrtho (0, GetSize().x, GetSize().y, 0, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
-
int const width = 1998;
int const height = 1080;
unsigned char image[width * height * 3];