jwatte

08-10-2008, 01:22 PM

I'm rendering to two depth textures using two FBOs. The texture images look OK. Texturing with either texture image looks as expected (one is coarser than the other). However, if I try to texture using both images, using texture2DProj() using two varyings for texture coordinates, and two texture units, then only the first texture seems to work right.

Is this another NVIDIA driver bug, or am I crazy? With GL, there's no PIX for Windows, and no REF driver, so it's harder to tell than under Direct3D.

Here's my vertex shader and fragment shader. Not particularly advanced...

// vertex shader

varying vec3 N;

varying vec4 P0;

varying vec4 P1;

uniform mat4 world;

uniform mat4 worldViewProjection;

uniform mat4 lightViewProjection0;

uniform mat4 lightViewProjection1;

attribute vec3 position;

attribute vec3 normal;

void main(void)

{

gl_Position = worldViewProjection * vec4(position, 1);

vec4 temp = world * vec4(position, 1);

P0 = lightViewProjection0 * temp;

P1 = lightViewProjection1 * temp;

N = (world * vec4(normal, 0)).xyz;

}

// fragment shader

varying vec3 N;

varying vec4 P0;

varying vec4 P1;

uniform vec3 lightDirection;

uniform sampler2D lightDepthTexture0;

uniform sampler2D lightDepthTexture1;

void main(void)

{

float c = 1.0;//texture2DProj(lightDepthTexture0, P0).x;

c = c * texture2DProj(lightDepthTexture1, P1).x;

c = c * 0.9 + 0.1;

float b = dot(N, lightDirection) * c + 0.1;

gl_FragColor = vec4(b, b, b, 1);

}

I'm using drivers 163.71 on a GeForce 7400m on Windows XP SP2 on a Sony VAIO SZ-140P laptop.

Is this another NVIDIA driver bug, or am I crazy? With GL, there's no PIX for Windows, and no REF driver, so it's harder to tell than under Direct3D.

Here's my vertex shader and fragment shader. Not particularly advanced...

// vertex shader

varying vec3 N;

varying vec4 P0;

varying vec4 P1;

uniform mat4 world;

uniform mat4 worldViewProjection;

uniform mat4 lightViewProjection0;

uniform mat4 lightViewProjection1;

attribute vec3 position;

attribute vec3 normal;

void main(void)

{

gl_Position = worldViewProjection * vec4(position, 1);

vec4 temp = world * vec4(position, 1);

P0 = lightViewProjection0 * temp;

P1 = lightViewProjection1 * temp;

N = (world * vec4(normal, 0)).xyz;

}

// fragment shader

varying vec3 N;

varying vec4 P0;

varying vec4 P1;

uniform vec3 lightDirection;

uniform sampler2D lightDepthTexture0;

uniform sampler2D lightDepthTexture1;

void main(void)

{

float c = 1.0;//texture2DProj(lightDepthTexture0, P0).x;

c = c * texture2DProj(lightDepthTexture1, P1).x;

c = c * 0.9 + 0.1;

float b = dot(N, lightDirection) * c + 0.1;

gl_FragColor = vec4(b, b, b, 1);

}

I'm using drivers 163.71 on a GeForce 7400m on Windows XP SP2 on a Sony VAIO SZ-140P laptop.