16
Feb
08

Repeating Texture Fragment Shader

Verrrry simple.

// Tile size (x,y)
uniform vec2 Tile;
//Declare a 2D texture as a uniform variable
uniform sampler2D Texture;

void main()
{
// Fragment coords
vec2 xy = gl_TexCoord[0].xy;
// Tile coords
vec2 phase = fract(xy / Tile);
//Multiply color by texture
vec4 outColor = gl_Color * texture2D(Texture, phase);
// Output fragment color
gl_FragColor = outColor;
}
Advertisements

0 Responses to “Repeating Texture Fragment Shader”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Twitter

February 2008
M T W T F S S
« Jan   Mar »
 123
45678910
11121314151617
18192021222324
2526272829  

Links

Blog Stats

  • 467,455 hits

%d bloggers like this: