This project is read-only.

This shader is almost the same as wave shader, except that this one has animation

 

Vertex shader

// Waving shader

// Created by Zhiyong Yang, younthu@yahoo.com.cn

//

// This is a wave shader, with time triggered animation.

uniform float time;

void main()

{

vec4 position= gl_Vertex;

position.z=(sin(position.x*5+time)+cos(position.y*5+time))*0.2;

gl_Position = gl_ModelViewProjectionMatrix * position;

gl_FrontColor = gl_Color;

gl_TexCoord[0] = gl_MultiTexCoord0;

}

Fragment shader

// simple fragment shader

// 'time' contains seconds since the program was linked.

uniform float time;

uniform sampler2D tex;

void main()

{

   gl_FragColor = gl_Color*texture2D(tex,gl_TexCoord[0].xy);

}

Sreenshot

waving

Last edited Mar 17, 2013 at 2:56 AM by younthu, version 5

Comments

No comments yet.