Fix GL information fetching.
[dcpomatic.git] / src / wx / gl_video_view.h
index fcf5dbcf251c890ca38945cc708ebbc945628874..bac195fb18016e5758d07a629bb48b8d71514a90 100644 (file)
@@ -28,11 +28,11 @@ DCPOMATIC_DISABLE_WARNINGS
 DCPOMATIC_ENABLE_WARNINGS
 #include <dcp/util.h>
 #include <boost/atomic.hpp>
-#include <boost/shared_ptr.hpp>
 #include <boost/thread.hpp>
 #include <boost/thread/condition.hpp>
 #undef None
 #undef Success
+#undef Status
 
 class GLVideoView : public VideoView
 {
@@ -40,37 +40,41 @@ public:
        GLVideoView (FilmViewer* viewer, wxWindow* parent);
        ~GLVideoView ();
 
-       wxWindow* get () const {
+       wxWindow* get () const override {
                return _canvas;
        }
-       void update ();
-       void start ();
-       void stop ();
+       void update () override;
+       void start () override;
+       void stop () override;
 
-       bool display_next_frame (bool);
+       NextFrameResult display_next_frame (bool) override;
 
        bool vsync_enabled () const {
                return _vsync_enabled;
        }
 
+       std::map<GLenum, std::string> information () const {
+               return _information;
+       }
+
 private:
-       void set_image (boost::shared_ptr<const Image> image);
+       void set_image (std::shared_ptr<const Image> image);
        void set_image_and_draw ();
        void draw (Position<int> inter_position, dcp::Size inter_size);
        void thread ();
        void thread_playing ();
        void request_one_shot ();
-       void create ();
        void check_for_butler_errors ();
+       void ensure_context ();
+       void size_changed (wxSizeEvent const &);
+       void setup_shaders ();
+       void set_border_colour (GLuint program);
 
-       /* Mutex for use of _canvas; it's only contended when our ::thread
-          is started up so this may be overkill.
-        */
-       boost::mutex _canvas_mutex;
        wxGLCanvas* _canvas;
        wxGLContext* _context;
 
-       GLuint _id;
+       boost::atomic<wxSize> _canvas_size;
+       GLuint _texture;
        boost::optional<dcp::Size> _size;
        bool _have_storage;
        bool _vsync_enabled;
@@ -81,5 +85,11 @@ private:
        boost::atomic<bool> _playing;
        boost::atomic<bool> _one_shot;
 
-       boost::shared_ptr<wxTimer> _timer;
+       GLuint _vao;
+       GLint _draw_border;
+       bool _setup_shaders_done = false;
+
+       std::shared_ptr<wxTimer> _timer;
+
+       std::map<GLenum, std::string> _information;
 };