c - Is it possible to copy data from a texture 2D (GL_TEXTURE_2D) to an array buffer (GL_ARRAY_BUFFER)? -
i developing program, can calculate histogram on gpu. i'm using opengl write code. in first step, load value of pixel (rgb) array (arr_image) , upload vertex buffer (vbo):
gluint vbo; glgenbuffers(1, &vbo); glbindbuffer(gl_array_buffer, vbo); gluint num_input_data = width * height; /* upload data */ glbufferdata(gl_array_buffer, num_input_data * sizeof(float) * 3, arr_image, gl_static_draw); and it's working, can calculate histogram of image.
but now, want load data texture (gl_texture_2d) (as results of previous steps) array buffer (gl_array_buffer). possible?
i'm not sure if overall approach best way go, i'm going address specific question here:
a buffer object in opengl can bound every buffer target. copy pixel data texture buffer object, can bind buffer gl_pixel_pack_buffer means using pixel buffer object (pbo). when pbo bound, operation reading pixel data gl write data pbo. can issue glgetteximage call. vbos, pixels pointer of these calls interpreted not client memory address, offset pbo.
you can bind buffer gl_array_buffer target , use source vertex data.
Comments
Post a Comment