glTexSubImage2D with pitch/stride

Hi,

I’m working on an application where it’s necessary to update sub rectangles of a big master texture. I basically have a software generated image buffer of say 1024x512 where I need to update say 128x64 subrects every now and then.

in OpenGL I can use this code:

char *data = image.data + (x + y * image.width) * 4;
glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width);
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, data);

How do I go about doing this in ES efficiently?

All I can think of is to either copy the new data to a temporary buffer and update, or to update it line by line. Neither of these seems very efficient. Is there a better way?

Thanks,
Peter

Yeah, I wonder how this can be done.

I’m currently updating the whole rows which is better than updating the whole texture but I really would like to have something like the GL_UNPACK_ROW_LENGTH to just update the rect I want.

If anybody knows for a solution it would be great to share it here :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.