Add some more OpenGL debugging.
authorCarl Hetherington <cth@carlh.net>
Tue, 4 Aug 2020 22:06:35 +0000 (00:06 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 4 Aug 2020 22:06:35 +0000 (00:06 +0200)
src/wx/gl_video_view.cc

index fe49a5b8ec3e056879d33d940d0734e6ac13aef1..215511538ed013a0cc076a14d0a14a22c16fdddc 100644 (file)
@@ -53,6 +53,17 @@ using std::cout;
 using boost::shared_ptr;
 using boost::optional;
 
 using boost::shared_ptr;
 using boost::optional;
 
+
+static void
+check_gl_error (char const * last)
+{
+       GLenum const e = glGetError ();
+       if (e != GL_NO_ERROR) {
+               throw GLError (last, e);
+       }
+}
+
+
 GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        : VideoView (viewer)
        , _have_storage (false)
 GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
        : VideoView (viewer)
        , _have_storage (false)
@@ -98,8 +109,11 @@ GLVideoView::GLVideoView (FilmViewer* viewer, wxWindow *parent)
 #endif
 
        glGenTextures (1, &_id);
 #endif
 
        glGenTextures (1, &_id);
+       check_gl_error ("glGenTextures");
        glBindTexture (GL_TEXTURE_2D, _id);
        glBindTexture (GL_TEXTURE_2D, _id);
+       check_gl_error ("glBindTexture");
        glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
        glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
+       check_gl_error ("glPixelStorei");
 }
 
 GLVideoView::~GLVideoView ()
 }
 
 GLVideoView::~GLVideoView ()
@@ -128,14 +142,6 @@ GLVideoView::check_for_butler_errors ()
        }
 }
 
        }
 }
 
-static void
-check_gl_error (char const * last)
-{
-       GLenum const e = glGetError ();
-       if (e != GL_NO_ERROR) {
-               throw GLError (last, e);
-       }
-}
 
 void
 GLVideoView::update ()
 
 void
 GLVideoView::update ()
@@ -257,6 +263,7 @@ DCPOMATIC_ENABLE_WARNINGS
        }
 
        glFlush();
        }
 
        glFlush();
+       check_gl_error ("glFlush");
 
        boost::mutex::scoped_lock lm (_canvas_mutex);
        _canvas->SwapBuffers();
 
        boost::mutex::scoped_lock lm (_canvas_mutex);
        _canvas->SwapBuffers();