NVIDIA 61.77 with GF6800 reads from wrong sampler2D?

I’m using version 61.77 drivers with a GF 6800. My fragment shader declares two uniform sampler2D variables. My driver application loads two separate texture images into texture units 0 and 1 (which are the locations reported by the uniform querying API).

Sadly, it seems that reading from both maps will read only the first sampler (mapped to unit 0). Has anyone else run into a bug like this? It seems like something I’m doing wrong, but I can’t figure it out.

Here is the fragment shader in all its glory, if I’m somehow doing something that my eyes won’t let me see :slight_smile: I know that the texture coordinate generation works right, and I also know that the underlying texture (unit 0) works right (easy to check by mix()-ing with a 0 mix value).

uniform sampler2D diffuseMap;
uniform sampler2D roadMap;
uniform vec4 roadS;
uniform vec4 roadT;

void main()
{
  //  texture first
  vec4 groundColor = texture2D(
      diffuseMap,
      gl_TexCoord[0].xy );

  //  road decal
  vec4 roadCoord = vec4( 0, 0, 0, 1 );
  roadCoord.x = dot( g_FragPos, roadS );
  roadCoord.y = dot( g_FragPos, roadT );

  vec4 roadColor = texture2D(
      roadMap,
      roadCoord);

  vec4 color = mix(
      groundColor,
      roadColor,
      roadColor.a );

  //  linear fog
  float fogDepth = -((gl_ModelViewMatrix * g_FragPos).z);
  fogDepth = clamp( 
      gl_Fog.scale * (fogDepth - gl_Fog.start),
      0,
      1 );

  //  calculate final color
  gl_FragColor = mix(
      gl_Color * color,
      gl_Fog.color,
      fogDepth );
}

Nevermind; the call to Uniform1i() to specify the texture unit to use for the sampler was missing. Nothing to see here.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.