iliak's picture

Shader and multi OpenTK context

Project:The Open Toolkit library
Category:support request


I have the following problem. I have a winform with two OpenTK contexts and one single shader (Fragment and Vertex) in a 3.0 forward context. When I try to render something in thoses contexts, only one context is ok and the other context draw junk (matrix problem I guess...). If I make the *same* rendering with two different shaders program instances (one context has its own shader, but exactly the same shader) everything is OK.

So my question is, does shaders are shared beetwen contexts ? Is there any work around ?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture


Shaders should be shared between contexts. Are other resources (e.g. textures) shared correctly?

iliak's picture


Yes textures are shared correctly, it's a really strange behaviour.

the Fiddler's picture


From reading the specs, it seems that shaders should be shared. One thing that comes to mind is that changes to the state of one context are not immediately visible to the second context: try checking whether the program is linked and valid in the second context before using it.

iliak's picture


You were right. My framework shader cache detected that I was trying to bind the same shader, but not in different context...

Thank you !

the Fiddler's picture


Category:bug report» support request
Status:open» closed

You are welcome. :)