2

I have an OpenGL program that needs to periodically update the textures. But at the same time I want the program to be responsive (specifically, to continue running the draw/display code) while it's updating these textures.

But this seems impossible: If I make thread1 do the draw/display code and thread2 to the texture moving, then they will conflict under the resource GL_ARRAY_BUFFER_ARB because thread2 has to keep that resource to move some textures over to a vbo. And I need GL_ARRAY_BUFFER_ARB to do the draw/display code for thread1 because that uses different vbo's.

For example this code

glBindBufferARB(GL_ARRAY_BUFFER_ARB, tVboId);
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, numVertices*2*sizeof(GLfloat), texCoords, GL_DYNAMIC_DRAW_ARB);  
    glBindBufferARB(GL_ARRAY_BUFFER_ARB,0);

will move some textures over but it will take a while. During that time the display code is supposed to run many times but it will instead crash, because GL_ARRAY_BUFFER_ARB is in use.

I thought I could do something like GL_ARRAY_BUFFER_ARB2 but there is no such thing, I think.

2 Answers 2

3

Use PBOs they allow you to do asynchronous transfers, read more here.

Sign up to request clarification or add additional context in comments.

Comments

0

This should help: http://hacksoflife.blogspot.com/2008/02/creating-opengl-objects-in-second.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.