I've had some problems with buffer corruption for the past few days, and only recently managed to narrow the problem to glUnmapBufferARB returning GL_FALSE. I've searched for what must be done in this case. Some say that the "data must be resubmitted". I must admit I have no idea what this could mean. Here's what I tried so far :
- After glUnmapBufferARV fails, I reset the data with glBufferDataARB with a NULL pointer. My code fails later with a glDrawRangeElements throwing a GL_INVALID_OPERATION (leading me to believe the buffer is still mapped)
- The same, with another glUnmapBufferARB after the glBufferDataARB call. Unfortunately, glUnmapBufferARB still returns GL_FALSE.
- Just another glUnmapBufferARB without a glBufferDataARB; it fails again.
With these results, I can't understand what I'm supposed to do... If I don't do anything, it will fail later when I try to draw with that buffer. If I try unmapping again, it fails again.
More than that, I just can't understand how this could fail ? The only possible cases specified in the VBO spec are context resizing, and some other, that don't happen at all in my app. This error happens in my code when a second thread with a second context (shared to the first on the main thread that is doing the rendering) is loading geometry in the VBOs. From the VBO spec again, this is a case that should work, even without locking the threads so that they don't work together, which I do anyway...
Anyone got any insights on this ?