I am using a PBO to update a texture. Each frame one line is updated. The documentation for glBufferSubData says:
Specifies the offset into the buffer object’s data store where data replacement will begin, measured in bytes.
I am always setting the offset to 0:
size_t offset = 0; glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboTexture); glBufferSubData(GL_PIXEL_UNPACK_BUFFER, offset, size, newColors);
Then the update:
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, line, textureWidth, 1, GL_RGBA, GL_FLOAT, BUFFER_OFFSET(0));
In my understanding this code should always overwrite the very first row in my texture. But the real offset is taken from the glTexSubImage2D()-call, so I can pass whatever I want into glBufferSubData()?