bingdianlieshou

11-05-2012, 05:53 PM

Hi ,here is my glsl code

#version 400

in vec4 ex_Color;

in vec4 ex_Pos;

out vec4 FragColor;

uniform sampler2D RayStartPoint;

uniform sampler2D RayStopPoint;

void main()

{

vec4 temp = ex_Color;

vec2 texc = ((ex_Pos.xy / ex_Pos.w) + 1.0f )/2.0f ;

vec4 startPosition = texture(RayStartPoint, texc) ;

vec4 stopPosition = texture2D(RayStopPoint, texc);

temp.w = 1 ;

// FragColor = startPosition ;

FragColor = stopPosition ;

// FragColor = temp ;

// FragColor = stopPosition - startPosition ;

}

my program could find the first uniform location,but can't find the second. the function "glGetUniformLocation" just return -1

anyone had encountered similar problem?

#version 400

in vec4 ex_Color;

in vec4 ex_Pos;

out vec4 FragColor;

uniform sampler2D RayStartPoint;

uniform sampler2D RayStopPoint;

void main()

{

vec4 temp = ex_Color;

vec2 texc = ((ex_Pos.xy / ex_Pos.w) + 1.0f )/2.0f ;

vec4 startPosition = texture(RayStartPoint, texc) ;

vec4 stopPosition = texture2D(RayStopPoint, texc);

temp.w = 1 ;

// FragColor = startPosition ;

FragColor = stopPosition ;

// FragColor = temp ;

// FragColor = stopPosition - startPosition ;

}

my program could find the first uniform location,but can't find the second. the function "glGetUniformLocation" just return -1

anyone had encountered similar problem?