Sign in to follow this  
obhi

OpenGL Locking and updating VBOs from a separate thread.

Recommended Posts

Hi,

I am fairly new to opengl so my question is, if I have to lock/update a vertex buffer object from a spearete thread what would be the way to go? More specifically do I have to create a new context and bind it to that thread? or can I manage with the original context bound to the updating thread? Given that I have made sure this buffer will not be used in the current draw call.

Thanks for any help.
-obhi

Share this post


Link to post
Share on other sites
Sorry for not doing much research!
Anybody looking for answers can look here:
[url="http://www.gamedev.net/topic/395910-vbo-and-multithreading/page__whichpage__1%25EF%25BF%25BD"]http://www.gamedev.net/topic/395910-vbo-and-multithreading/page__whichpage__1%25EF%25BF%25BD[/url]

Share this post


Link to post
Share on other sites
The magic word is glMapBuffer.
You call that in your main thread and the pointer it returns, you can keep it or send it to your other thread.
You have to call glUnmapBuffer later from your main thread.

You should also read this part "Dynamic VBO"
and it is doable from 1 thread

http://www.opengl.org/wiki/VBO_-_more

Share this post


Link to post
Share on other sites
Thanks for that link.
Passing the buffer pointer between the threads however is not the way i want to go.
Solely because the need to update the (backing) VBO is determined by the main thread while the renderer is already drawing the current updated data. So, the sync that will be necessary here (possibly by message passing) would make the whole process stall on each other. Not the way I would like it.

Thanks,
obhi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this