opengl es - How can I render my 2D background under the water with opengles -



opengl es - How can I render my 2D background under the water with opengles -

i rendering 2d background under water opengles. how can distort textures on time? know achive sin(time) or cos(time). i'm poor in glsl.i have no thought how it. shoud changed x,y coordination on time? how can avoid move whole texture repeatedly? help thanks.

you may distort texture coordinates in hope of achieving need few parameters.

for instance can utilize sin or cos function (not much of difference between them) distort horizontally moving x texture coordinate little amount. insert instance uniform (strength) should relative texture instance .1 distort maximum of 10%. thought set x=sin(y)*strength. since y in range 0 1 need add together parameter such density "more waves" should in range 20 instance few waves (change please test nice effect). equation becomes x=sin(y*density)*strength. still produce static distorted image want move on time need vertical time factor delta should changed on time , range between .0 , 2*pi , equation x=sin(y*density + delta)*strength. on every frame should increment delta , if larger 2*pi decrease 2*pi smooth animation. value increment delta command speed of effect.

so have 3 uniform parameters should seek play around desired effect. hope find it.

opengl-es libgdx effect

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -