Uniforms, varyings, GL state and...globals?

Started by
0 comments, last by mod42 18 years, 5 months ago
Hi all, As far as I know, with GLSL you can use uniforms, varyings, and you got access to all usefull GL state variables (matrix, planes, lights, etc) but... Is there any kind of "global" variables shared by all program objects, apart from the GL states? I mean, if you want to use a variable "time" in some shaders (for doing some kind of time dependent computation), and you define it as a "uniform float", then you will need to update it one time per each shader using it for every frame. So I'm just wondering if I missed some point in the GL Shading Language spec, and there is any way to set a common variable than can be read by all shaders, without having to programataically set it for each one ¿do you know what I mean? So far, the only way I can think of doing it is by setting over an unused GL state variable (the X component of some user clip plane, for example), and program the shaders asuming that state variable will actaually contain a "time" value... Any hints?
Advertisement
Hi

I dont know any direct way to do this (besides on some self written shader container object which handles that for you) in any other way then using a GL state for that purpose.

mod42

This topic is closed to new replies.

Advertisement