View Full Version : Stupid newbie question about sampler2D

02-29-2004, 09:59 AM
OK, I want to use 2 float pbuffers to store results of calculations I am performing in the fragment shader. For the life of me, though, I can't figure out how a sampler2D works. Obviously, I need to write something like

uniform sampler2D tex0; // GL_TEXTURE0_ARB
uniform sampler2D tex1; // GL_TEXTURE1_ARB

and then

vec4 color0 = texture2D(tex0, vec2[gl_TexCoord[0]));
vec4 color1 = texture2D(tex1, vec2[gl_TexCoord[1]));

but how do I ensure that tex0 points to GL_TEXTURE0_ARB, and tex1 points to GL_TEXTURE1_ARB? I have gone over the documentation from front to back, and I can't seem to figure out how this works.


02-29-2004, 10:37 AM