This is a vertex shader, which wil change the z of vertex according to x and y.


Source code

Vertex shader

// Wave shader

// Created by Zhiyong Yang,

void main()


vec4 position= gl_Vertex;


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);






Last edited Mar 16, 2013 at 4:28 AM by younthu, version 1


No comments yet.