OpenGL ES 2.0 shader, how is time variable called?
I try to per开发者_StackOverflowform such pixel shader:
"#ifdef GL_ES\n"
" precision highp float;\n"
" #endif\n"
" \n"
" uniform float time;\n"
" uniform vec2 resolution;\n"
"\n"
" void main( void ) {\n"
"\n"
" vec3 rgb = vec3( abs( sin( time / 5.0 ) ), 0.0, 0.0 );\n"
" gl_FragColor = vec4( rgb, 1.0 );\n"
"\n"
" }\n"
I want it to work alike this webGL mrdoob sample (from black to red). But it seems like time variable here is just 0...(
BTW sample shown here runes as expected.
So is there any "time variable" in pixel shaders for OpenGL ES 2.0?
Check the page source on your first link. You have to calculate and pass in the time
value from your host program.
OpenGL ES 2.0 has no notion of time, wall-clock or otherwise.
精彩评论