Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want be able to move my texture in GLSL I have set my texture to wrap S and wrap T but not sure why it wont move

my fragment shader looks like this at the moment

uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;

varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;

//This gets updated within the main code
uniform mediump float vTime;

void main()

    gl_FragColor =  texture2D(n_mapTex, vec2(TexCoord.x + vTime, TexCoord.y + vTime));

within my code I have a made a function to calculate FPS and I use the delta time of that function to pass into the fragment shader

void OGLESIntroducingPVRTools::timer(){
/*This method records to the time to start rendering a frame and hold that value
in another variable we then start to count again.  To get delta time we subtact
the current time from the previous time this will give us in milliseconds how
long it took for a frame to render.  We then divide this by 1000 this converts
it from ms per frame to FPS*/


p_Time = c_Time;
c_Time = PVRShellGetTime();

elapsed = c_Time / 1000.0f;
DT = ((float)(c_Time - p_Time)) / 1000.0f;

fCount += DT;

if(fCount >= 1.0f) //if time is over 1 second reset counters and recount
    FPS = FrameCount;
    FrameCount = 0;
    fCount = 0;


and in my renderscene method which updates I have this code to pass the value to the uniform within the fragment shader

glUniform1i(glGetUniformLocation(m_ShaderProgram.uiId, "vTime"), DT);
share|improve this question
up vote 1 down vote accepted

vTime is a float, but you're passing it as an int, since you're using glUniform1i(). Adding integer values to your texcoords has no effect.

Use glUniform1f() instead.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.