c++ - efficiently copy subimage from host to opengl pixel buffer object -
i moving data cpu host opengl memory , using pixel buffer object that. can copy whole image so:
glbindbuffer(gl_pixel_unpack_buffer, buffer); glubyte * data = (glubyte *)glmapbuffer(gl_pixel_unpack_buffer, gl_read_write); // copying 4 channel 8 unsigned char data memcpy(data, cpu_data, rows * cols * 4);
this quite fast. however, need copy rectangular subimage of data. so, in essence need multiple memcpy this, take performance hit have copy things line line. wondering if somehow there faster way perform operation.
Comments
Post a Comment