diff options
| author | Carl Hetherington <cth@carlh.net> | 2019-05-10 16:37:16 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2019-05-10 23:43:55 +0100 |
| commit | e153d7f5dc128d97160e41bdda3c4e4a05c7140b (patch) | |
| tree | 707f9798a7a6ecd027bc64894351430c6da7b940 /src/wx/gl_video_view.cc | |
| parent | 45b0314b61c3c3b588648fb410f82546a4e5b40c (diff) | |
Fix update on drag with GL canvas.
Diffstat (limited to 'src/wx/gl_video_view.cc')
| -rw-r--r-- | src/wx/gl_video_view.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index f75d50f9d..b3f036ded 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -41,7 +41,7 @@ GLVideoView::GLVideoView (wxWindow *parent) { _canvas = new wxGLCanvas (parent, wxID_ANY, 0, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE); _context = new wxGLContext (_canvas); - _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this, _1)); + _canvas->Bind (wxEVT_PAINT, boost::bind(&GLVideoView::paint, this)); _canvas->Bind (wxEVT_SIZE, boost::bind(boost::ref(Sized))); glGenTextures (1, &_id); @@ -65,10 +65,26 @@ check_gl_error (char const * last) } void -GLVideoView::paint (wxPaintEvent &) +GLVideoView::paint () { _canvas->SetCurrent (*_context); wxPaintDC dc (_canvas); + draw (); +} + +void +GLVideoView::update () +{ + if (!_canvas->IsShownOnScreen()) { + return; + } + wxClientDC dc (_canvas); + draw (); +} + +void +GLVideoView::draw () +{ glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); check_gl_error ("glClear"); |
