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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -