• Advertisement
Sign in to follow this  

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

This topic is 4472 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement