I try to understand why I need to “re-create/allocate” image texture after a PBO upload…
Execution:
[ol]
[li]glGenTextures() [/li][li]glBindTexture() [/li][li]glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0) //just memory/buffer allocation [/li][li]glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, wh4, GL_MAP_WRITE_BIT) [/li][li]memcpy(…) [/li][li]glUnmapBuffer() [/li][li]…GPU fence waiting upload… [/li][li]glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0) //same as n.3!!! [/li][/ol]
If I comment last line (n.8) I get a texture with “random”/wrong pixels color…
glMapBufferRange and memcpy functions should have uploaded/updated/refreshed texture’s bytes, so why the last command (n.8) needed to be executed?
Thanks