opengl - Trouble using glTexSubImage2D with a pixel buffer object -


i trying upload subset of image texture. so, follows:

glbindtexture(gl_texture_2d, textureid); glbindbuffer(gl_pixel_unpack_buffer, buffer);  glpixelstorei(gl_unpack_row_length, width); glpixelstorei(gl_unpack_skip_pixels, x_offset); glpixelstorei(gl_unpack_skip_rows, y_offset);  gltexsubimage2d(gl_texture_2d, 0, x_offset, y_offset, width, height,                 gl_bgra, gl_unsigned_byte, null);  glpixelstorei(gl_unpack_row_length, 0); glpixelstorei(gl_unpack_skip_pixels, 0); glpixelstorei(gl_unpack_skip_rows, 0); 

this code works fine when x , y offsets set 0 , width , height set texture width , height. however, whenever try subset, can rubbish image looks noise.

i can understand part of texture being noisy not initialized proper values (due code reading subset) expected block representing subset have proper values.


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? -