Texture Sampler Example
This tutorial demonstrates various texture sampler settings.
Scrollwheel To Zoom
uniform mat4 worldViewProjection; // input parameters for our vertex shader attribute vec4 position; attribute vec2 texCoord0; // input parameters for our pixel shader varying vec2 texCoord; /** * Our vertex shader */ void main() { gl_Position = worldViewProjection * position; texCoord = texCoord0; }
varying vec2 texCoord; uniform sampler2D texSampler; /* Given the texture coordinates, our pixel shader grabs the corresponding * color from the texture. */ void main() { gl_FragColor = texture2D(texSampler, texCoord); }