Hi,
I do not understand the behavior of ClearBufferData in my OpenGL 4.3 application. Basically, it seems that clearing a buffer with ClearBufferData then writing into it in shaders causes the buffer to always be empty after the shaders execute.
Specifically, my application does the following:
- ClearBufferData of myBuffer
- Make myBuffer resident on the GPU and set it as a uniform in shaders
- a. Enable shaders
- b. Draw stuff with shaders (each fragment shader writes into myBuffer)
- c. Disable shaders
- Make myBuffer non resident
After #4 myBuffer contains all 0’s. However, if I do not clear myBuffer (remove #1) then its contents is written by the shaders as I would expect. I’ve tried putting a Finish() call between the clear and draw, but it has no effect. What is going on here? I’d appreciate any explanation.
Thanks!