It is in the GLSL language specs (though it is not likely as clear as
it should be), the Orange Book (though it has a number of errors)
likely has a better discussion and some examples.
DISCUSSION: Samplers are special uniforms used in the OpenGL
Shading
Language to identify the texture object used for each texture
lookup.
The value of a sampler indicates the texture image unit being
accessed.
The type of the sampler identifies the target on that texture
image
unit. The texture object bound to that texture image unit's
target is
then used for the texture lookup. For example, a variable of type
sampler2D selects target TEXTURE_2D on its texture image unit.
Binding
of texture objects to targets is done as usual with BindTexture.
Selecting the texture image unit to bind is done as usual with
ActiveTexture.
The location of a sampler needs to be queried with
GetUniformLocationARB, just like any uniform variable, and its
value
needs to be set by calling Uniform1i{v}ARB.
In the future, sampler types might allow for binding a texture
object
directly, instead of binding to a texture image unit first, to
get to a
texture object.
Geoff Stahl
3D Software Engineer
Apple
On May 30, 2005, at 8:48 PM, tobias ford wrote:
Thanks! That was all that I needed. Where was this documented?
Also, Shader Builder actually crashes a lot for me when using the
software renderer. Is this standard or just me and my powerbook?
-------------------
Tobias Ford...
tobias1482 'at' mac.com
tford 'at' soe.sony.com
-------------------
Programmer @ SOE Austin for Star Wars Galaxies
On May 30, 2005, at 6:48 PM, Keith Bauer wrote:
To the best of my knowledge the program below should pass through
the second unit texture, but It's always using the first texture.
See the list of uniforms on the right? See texture0 and texture1
in there? The values of their X components determine which
texture units they're bound to. Set texture0's X to 0 and
texture1's X to 1 to get the effect the names suggest, but there
are other possibilities too ;)
-Keith
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/mac-opengl/email@hidden