1

I am trying to run different iterations of a shader program based on system time. I am hoping to set up an if else code to run one iteration of the program during the day and another at night. At the moment, I can't find how to bring system time into the glsl file. Any thoughts? Thanks!

futuregoby
  • 11
  • 2

1 Answers1

0

Two options:

  1. Pass the time in a uniform from your application (e.g. number of seconds since midnight)
  2. If it's really just an if/else for day/night you can run a different shader program depending on the time. One way to do this would be to add conditional preprocessor directives (#if defined(DAY)) instead of if/else, and modify the shader code dynamically before loading the program (add/remove #define day with basic string manipulation).
kshahar
  • 10,423
  • 9
  • 49
  • 73