U_time in my c++ app

Hi, why is the color not animated in my cpp app? Do I miss something?

#ifdef GL_ES

precision mediump float;


uniform vec2 u_resolution;

uniform float u_time;

vec3 colorA = vec3(0.912,0.411,0.288);

vec3 colorB = vec3(1.000,0.833,0.224);

void main() {

  vec3 color = vec3(0.0);

  float pct = abs(sin(u_time));

  // Mix uses pct (a value from 0-1) to

  // mix the two colors

  color = mix(colorA, colorB, pct);

  gl_FragColor = vec4(color,1.0);


Many thanks

Are you sure that you’re properly changing the u_time uniform?
What value is u_time being assigned in the first frame? In the second frame, in the third frame, etc.
Is u_time varying from 0 to 2*pi over a second or two?

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