arithon
10-24-2007, 08:24 AM
Does anyone have any tips in order to get FBOs working with multiple threads?
After fighting with it for a while I decided to make it easy for me and do a simple test. The main thread first initializes the GL context and then does:
glGenFramebuffersEXT( 1, &_object );
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, _object );
GLboolean isValid = glIsFramebufferEXT( _object );isValid is true and I can call all other FBO-related functions. I then create a second thread, a compatible context and share the data, which basically boils down to calls to wglCreateContext, wglShareLists, wglCopyContext and wglMakeCurrent (this code is well tested and works with other tests).
Finally I perform the same code as above in the second thread and isValid is now false. In fact, all FBO-related functions are completely messed up. glCheckFramebufferStatusEXT for example returns zero, something it shouldn't do unless it generates and error, but glGetError then returns no error.
Anything specific I should keep in mind when dealing with FBOs and threads?
This is on a Windows XP system with a nVidia 8600 GTS card. Oh, and it works just as it should on my MacBook Pro with an ATI card.
After fighting with it for a while I decided to make it easy for me and do a simple test. The main thread first initializes the GL context and then does:
glGenFramebuffersEXT( 1, &_object );
glBindFramebufferEXT( GL_FRAMEBUFFER_EXT, _object );
GLboolean isValid = glIsFramebufferEXT( _object );isValid is true and I can call all other FBO-related functions. I then create a second thread, a compatible context and share the data, which basically boils down to calls to wglCreateContext, wglShareLists, wglCopyContext and wglMakeCurrent (this code is well tested and works with other tests).
Finally I perform the same code as above in the second thread and isValid is now false. In fact, all FBO-related functions are completely messed up. glCheckFramebufferStatusEXT for example returns zero, something it shouldn't do unless it generates and error, but glGetError then returns no error.
Anything specific I should keep in mind when dealing with FBOs and threads?
This is on a Windows XP system with a nVidia 8600 GTS card. Oh, and it works just as it should on my MacBook Pro with an ATI card.