I have simple application. It has two threads. Each thread has it's own rendering context, but they share one VBO (this is working, I tested it).
Now what I want: One thread is rendering some data from first half of VBO and the second thread is updating second part of VBO.
When I don't update VBO, it's working fine.
But I have some weird issues when updating. When I use glMapBuffer to update VBO (in second thread), it's most time rendering nothing (in first thread) - whole screen is clear (after glClear call). It looks like it can't touch data from VBO (this is understandable, because whole buffer is mapped and so it can be locked somehow).
I tried to use glMapBufferRange, which has flag GL_MAP_UNSYNCHRONIZED_BIT. This should mean: don't wait and use VBO as you want, I will synchronize it by myself. Also - when I map only range of VBO and render data from other part, it shouldn't be waiting. But there are the same issues as with glMapBuffer.
Can anybody explain why or help me, how to fix this? This is my first multi-thread OpenGL app :\