Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Weird problem accessing VBO from shared context.

  1. #1
    Newbie Newbie
    Join Date
    Jan 2017
    Posts
    2

    Weird problem accessing VBO from shared context.

    There are two contexts, a worker context and a render context. During setup, the worker thread creates and sets up the shader and VBO. The render thread then uses the the VBO to create a VAO and draw it. I get nothing on screen (or old vertices, see below).

    If I allow the render thread to also create the VBO before it creates the VAO, everything works, I see a triangle, rendered with the shader program created in the worker thread.

    The really weird part is after it works, if I switch it back to VBO creation in the worker thread, I still see the triangle but if I change the geometry of the triangle it is not updated until I switch it back to VBO creation in the render thread.

    This is incredibly odd. Both ways the render context is using a shader created in the worker context, but I can't seem to share the VBO, yet when the worker context creates the VBO the vertices are not updated and the triangle from the previous program run draws.

    I'm on Ubuntu 16. This was happening with glew, now glbinding, and my own compiled latest glfw3 and the Ubuntu package as well.

    In summary, VBO creation and drawing works from the main thread with a shader created from the worker thread. If I try to create a VBO with the worker thread (same function) I seem to get access to a new buffer that happens to have old data when it is used in the render thread...

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    849
    How are you ensuring that your VBO modifications on the worker thread are visible to the main thread?

  3. #3
    Newbie Newbie
    Join Date
    Jan 2017
    Posts
    2
    glFlush() did it, thanks so much, that was incredibly frustrating.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •