Archive 17/01/2023.

Create shader (GLSL) from string

vrivotti

Is it possible to create a shader and associate it with a technique pass directly from code?
Thank you.

cadaver

It should be possible, but isn’t very straightforward. Create a shader resource, “load” it from a VectorBuffer or MemoryBuffer that contains the source code (both VS & PS, like the files) then store it to the ResourceCache as a “manual resource” (AddManualResource). You must set a fake filename for the resource so that the Renderer will eventually find it properly, for example “Shaders/GLSL/MyShader.glsl”

vrivotti

Ok, thank you cadaver.