X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=input.cpp;h=453620c41df023353fc943c920cd117673c0f1b2;hp=1e460f09606d89bcb15064ed36b535b869806146;hb=6a31570f6a85004d33a83bbe2f77642614361da6;hpb=d3cf1194740dbecde06f5e721a7e1910437a7666 diff --git a/input.cpp b/input.cpp index 1e460f0..453620c 100644 --- a/input.cpp +++ b/input.cpp @@ -46,7 +46,9 @@ void Input::finalize() } // Create PBO to hold the texture holding the input image, and then the texture itself. - glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 2); + glGenBuffers(1, &pbo); + check_error(); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo); check_error(); glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, width * height * bytes_per_pixel, NULL, GL_STREAM_DRAW); check_error(); @@ -73,7 +75,7 @@ void Input::set_gl_state(GLuint glsl_program_num, const std::string& prefix, uns { if (needs_update) { // Copy the pixel data into the PBO. - glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 2); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo); check_error(); void *mapped_pbo = glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY); memcpy(mapped_pbo, pixel_data, width * height * bytes_per_pixel);