diff options
| author | Carl Hetherington <cth@carlh.net> | 2021-09-13 01:13:30 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-09-27 13:41:46 +0200 |
| commit | 56e0452ce0f436e7c54a49c68b272797f92a7ffe (patch) | |
| tree | 0977a9668bf338583d0ff2e552952551991897da /src/wx/gl_video_view.cc | |
| parent | f802565830bed9ec9e7ad6c16ccaa7b0700625d9 (diff) | |
Add basic Texture wrapper for a GL texture.
Diffstat (limited to 'src/wx/gl_video_view.cc')
| -rw-r--r-- | src/wx/gl_video_view.cc | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/wx/gl_video_view.cc b/src/wx/gl_video_view.cc index 035d337e5..7fb387f53 100644 --- a/src/wx/gl_video_view.cc +++ b/src/wx/gl_video_view.cc @@ -114,8 +114,6 @@ GLVideoView::~GLVideoView () _thread.interrupt (); _thread.join (); } catch (...) {} - - glDeleteTextures (1, &_video_texture); } void @@ -464,7 +462,6 @@ GLVideoView::draw (Position<int>, dcp::Size) glViewport (0, 0, width, height); check_gl_error ("glViewport"); - glBindTexture(GL_TEXTURE_2D, _video_texture); glBindVertexArray(_vao); check_gl_error ("glBindVertexArray"); glUniform1i(_fragment_type, _optimise_for_j2k ? 1 : 2); @@ -668,10 +665,8 @@ try _vsync_enabled = true; #endif - glGenTextures (1, &_video_texture); - check_gl_error ("glGenTextures"); - glBindTexture (GL_TEXTURE_2D, _video_texture); - check_gl_error ("glBindTexture"); + _video_texture.reset(new Texture()); + _video_texture->bind(); while (true) { boost::mutex::scoped_lock lm (_playing_mutex); @@ -718,3 +713,24 @@ GLVideoView::request_one_shot () _thread_work_condition.notify_all (); } + +Texture::Texture () +{ + glGenTextures (1, &_name); + check_gl_error ("glGenTextures"); +} + + +Texture::~Texture () +{ + glDeleteTextures (1, &_name); +} + + +void +Texture::bind () +{ + glBindTexture(GL_TEXTURE_2D, _name); + check_gl_error ("glBindTexture"); +} + |
