Textures, shaders, threads


following problem: All shaders are compiled, linked and work perfect in a single-threaded application. Then I try to use the shaders in a newly created thread and I get all black, texture lookup always returns 0.0, writing to gl_FragColor has no effect as long as texture coordinates are passed. Fixed function pipeline works perfect in the second thread! Any ideas?!

Btw there are no GL errors reported, glXMakeCurrent does not fail, glIsProgram returns no error if called from the second thread on a program created in the main thread.

If anybody has experience with multithreaded GL programming please share it or point me to right references. Your help is really appreciated!

I have already checked the posts in the windows specific forum but the problem discussed there is about making a context current in a second thread.

Thanks for your help!

This is not relied to shaders. You must share your texture objects between threads. How to do that depends on your system, generally with giving the shared context when creating the newlie one.

Thanks for the hint! I created a new context within the secondary thread and share the texture objects with the context from the main thread where they were created. Unfortunately I can’t tell if it works because I cannot access the Framebuffer object which was created in the main threads context. Is there a way to share these objects too? Creating a new fbo within the secondary thread does not work - the nVidia driver segfaults if I try to bind a newly created fbo. Any Idea on this problem?


This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.