1
\$\begingroup\$

I know I can use shader:send() to change variables, but is there a way to set/change a #define?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Can you elaborate with an example of what you're trying to do? \$\endgroup\$
    – DMGregory
    Jan 19 '19 at 16:35
1
\$\begingroup\$

Shaders don't really work that way. Once the shader is compiled, any instance of the name you defined will be replaced with its value. If you want something that changes throughout your program, use a variable.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Can you suggest a way that OP can set the #define and compile a new version of the shader with that configuration? \$\endgroup\$
    – DMGregory
    May 26 '19 at 14:11
1
\$\begingroup\$

No, there is no way to do that. However, you can prepend a #define macro to the shader code when creating the shader.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .