Jump to content
  • Advertisement
Sign in to follow this  
Aressera

OpenGL Strange latency when updating dynamic VBO with glUnmapBuffer()

This topic is 1077 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I use a custom immediate-mode renderer for things like GUI, debug drawing. This works a lot like the old OpenGL immediate mode. To render something, the operations that I am doing are:

  1. orphan the previous buffer memory with glBufferData( NULL ), usage = GL_DYNAMIC_DRAW;
  2. map vertex buffers for position, normal, uv, etc with glMapBuffer();
  3. write vertex data directly to the mapped buffer pointers.
  4. unmap vertex buffers with glUnmapBuffer();
  5. render the data in the buffers.

This works pretty well in most cases and is also pretty fast. However, I am getting a strange artifact when I render dynamic vertex data (e.g. frustum of a rotating camera). The rendered output seems to lag behind the rest of my scene by a few frames. i.e. on frame (n) it seems to render the scene from frame (n) combined with the immediate mode output from frame (n-3). This looks like really bad jitter when the motion is fast.

 

The only thing I can think that is causing this is that there is some significant latency between when I call glUnmapBuffer() and when the vertex buffers are actually used for rendering. My understanding that glUnmapBuffer() should block the caller until the vertex data has been copied to the GPU, but this doesn't seem to be the case.

 

If I can't get it to work without these artifacts I will try next to just build the vertex buffers in CPU memory and then glBufferData() to copy the data to the buffers.

 

Any ideas as to the cause/fix of this problem?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!