WebGL Color Filter GLSL

This Web page includes the GLSL shader source code. Select buttons labeled, Red, Green, or Blue to filter color channels from display of an image.

Vertex Shader Fragment Shader Texture Summary

Vertex Shader

 
attribute vec4 a_position;   
attribute vec2 a_tex_coord0;
varying vec2 v_tex_coord0;
           
uniform mat4 um4_matrix;
uniform mat4 um4_pmatrix; 
           
void main(void) {
 gl_Position = um4_pmatrix * um4_matrix * a_position; 
 
 v_tex_coord0 = a_tex_coord0;      
}

Fragment Shader

precision mediump float;

uniform sampler2D u_sampler0;
uniform vec4 uv4_color; 
varying vec2 v_tex_coord0;
    	
void main(void) {  
 vec4 v4_color = texture2D(
  u_sampler0, 
  v_tex_coord0)
  * uv4_color;
  gl_FragColor = v4_color;
}

Texture Map

Jets Texture Map

Summary

Select buttons labeled, Red, Green, or Blue to filter color channels from display of an image.

Tags
WebGL shaders, WebGL shader, WebGL examples, Web GL, HTML5, 3D Web, OpenGL ES, gpu, shader programming, shader tutorial, 3D graphics, opengl shading language, vertex shader, webgl shader language, vertex shader tutorial, javascript, html5, learn webgl, webgl samples, html5 canvas tutorial,
Learn 3D Programming Learn 3D Programming
Copyright © 2015 Seven Thunder Software. All Rights Reserved.