Texture not animating only shows black model

hey guys I am trying to animate my texture using a bump map however it just comes up as a black model…well kind of dark blue

attribute highp vec3  inVertex;

uniform highp   mat4  MVPMatrix;
uniform mediump vec3  LightDir;
uniform mediump vec3  EyePos;
uniform mediump vec2  inTexCoord;
uniform mediump vec2 watermovementX;
uniform mediump vec2 watermovementY;
uniform mediump vec2 waterSX;
uniform mediump vec2 waterSY;

varying mediump vec3  EyeDir;
varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;
varying mediump vec2  RefCoord;
varying mediump float WaterToEyeLength;

void main()
	// Transform position
	gl_Position = MVPMatrix * vec4(inVertex,1.0);
	mediump vec2 waterCoord = inTexCoord;
	TexCoord = waterCoord.xy * waterSX; //this line scales the bump map
	TexCoord += watermovementX; //this line translates the bump map
	TexCoord2 = waterCoord.xy * waterSY;
	TexCoord2 += watermovementY;
	RefCoord = inTexCoord;
	mediump vec3 WaterToEye = EyePos - inVertex;
	WaterToEyeLength = length(WaterToEye);


uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;
uniform sampler2D  reflectionTex;
uniform lowp float distortion;
uniform lowp vec4  WaterColour;

varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;
varying mediump vec2  RefCoord;
varying mediump float WaterToEye;

void main()
	//calculate water movement
	lowp vec3 aNormal = vec3(0.0, 0.0, 1.0);
	aNormal = texture2D(n_mapTex, TexCoord).xyz;
	aNormal += texture2D(n_mapTex, TexCoord2).xyz;
	aNormal -= 1.0;
	lowp vec2 watermovement = aNormal.st;
	mediump vec2 texMove = watermovement * (distortion/WaterToEye);
	gl_FragColor = texture2D(reflectionTex, texMove);

code to update

waterTran += water_Vel * DT;
	waterTran = PVRTVec2(	fmod(waterTran.x, 1.0f), fmod(waterTran.y, 1.0f));
	waterTran2 += water_Vel2 * DT;
	waterTran2 = PVRTVec2(	fmod(waterTran2.x, 1.0f), fmod(waterTran2.y, 1.0f));

	glUniform2fv(m_ShaderProgram.auiLoc[eW_Move],1, &waterTran.x);
	glUniform2fv(m_ShaderProgram.auiLoc[eWaterS],1, &water_S.x);
	glUniform2fv(m_ShaderProgram.auiLoc[eW_Move2],1, &waterTran2.x);
	glUniform2fv(m_ShaderProgram.auiLoc[eWaterS2],1, &water_S2.x);
	glUniform1f(m_ShaderProgram.auiLoc[eDist], pertubation);

DT = delta time

Could you show us the application code where you pass the texture uniforms to the shader. I suspect all of the shader samplers are referring to a single texture unit. I may be wrong though but you need to show us that code bit as well.

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