_thread.interrupt ();
_thread.join ();
} catch (...) {}
-
- glDeleteTextures (1, &_video_texture);
}
void
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);
_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);
_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");
+}
+
#undef Success
#undef Status
+
+class Texture
+{
+public:
+ Texture ();
+ ~Texture ();
+
+ Texture (Texture const&) = delete;
+ Texture& operator= (Texture const&) = delete;
+
+ void bind ();
+
+private:
+ GLuint _name;
+};
+
+
class GLVideoView : public VideoView
{
public:
wxGLContext* _context;
boost::atomic<wxSize> _canvas_size;
- GLuint _video_texture;
+ std::unique_ptr<Texture> _video_texture;
boost::optional<dcp::Size> _video_size;
bool _have_storage;
bool _vsync_enabled;