04-25-2006, 02:39 AM
Anyone know how to do it?for example ,a RGBA texture as parament?
Or give me a example?
I read orange book ,but can't find where can tell me to do it!
04-25-2006, 04:04 AM
What do you mean by that? If having the same parameter shared between different programs (as only programs in GLSL can have parameters; shaders themselves can't), it's not possible: each program has completely separate space of parameters (and location identifies a parameter only inside a specific program).
However, it's possible (in a way) to share a texture as a parameter. As you know, you set the texture parameter by setting the number of texture unit the texture is currently bound to. So, if you set the same texture unit as a texture parameter in 2 different programs, you can then "share" it in a way, that is, binding another texture to the unit will affect both programs, as long as the unit they reference remains the same.
Is that what you want? For simple parameters (i.e., vectors or matrices), there is also a way to "share" them. As you probably know, OpenGL allows the shader to access a number of predefined state parameters. So, using one of these for your own purposes allows you to share simple parameters between several problems. This may lead to some performance issues (as the driver has to set these parameters under the hood), and you should be careful with using such "state" with other OpenGL calls, however, it should work.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.