Unbind buffer before calling functions that can throw
authormalc <av1474@comtv.ru>
Sun, 2 Dec 2012 18:36:01 +0000 (2 22:36 +0400)
committermalc <av1474@comtv.ru>
Sun, 2 Dec 2012 18:36:01 +0000 (2 22:36 +0400)
link.c

diff --git a/link.c b/link.c
index a7e91b3..c2ac33b 100644 (file)
--- a/link.c
+++ b/link.c
@@ -3395,6 +3395,7 @@ CAMLprim value ml_getpbo (value w_v, value h_v, value cs_v)
                                NULL, GL_STREAM_DRAW);
         pbo->ptr = state.glMapBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB,
                                          GL_READ_WRITE);
+        state.glBindBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0);
         if (!pbo->ptr) {
             fprintf (stderr, "glMapBufferARB failed: %#x", glGetError ());
             state.glDeleteBuffersARB (1, &pbo->id);
@@ -3420,7 +3421,6 @@ CAMLprim value ml_getpbo (value w_v, value h_v, value cs_v)
             ret_v = caml_copy_string (s);
             free (s);
         }
-        state.glBindBufferARB (GL_PIXEL_UNPACK_BUFFER_ARB, 0);
     }
     else {
         ret_v = caml_copy_string ("0");