View Full Version : GLSL step through colour sequence

08-16-2016, 04:30 AM
I was wondering if anybody from the community could help my relatively novice knowledge of OpenGL shaders.
I am trying to understand how to create a step sequence without easing, that steps through a large sequence of colours (256), one color at a time.
At present I am not concerned with whether this color table is HSL or RGB, and unsure if I would have to input the values for each color accordingly, or if there is an easier method for me to do this?


08-24-2016, 03:15 PM
Since GLSL doesn't have any concept of time, this is probably something I would do application code instead. It would be easy to vary your color with time in your code and then pass it to your shader to be rendered.

If you really want to have more of the logic in a shader, you could build your color table as a 1D texture. Then you could pass a time variable to your shader as a uniform, and program some shader logic that converts the time to a texture coordinate to look up a color in your 1D texture.