Changeset 2589


Ignore:
Timestamp:
Mar 13, 2013, 5:49:41 PM (10 years ago)
Author:
sam
Message:

tutorial: randomise colours.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tutorial/12_texture_to_screen.lolfx

    r2580 r2589  
    2424varying vec2 pass_position;
    2525
     26vec3 rand_color(float t)
     27{
     28    return vec3(0.5 + 0.5 * sin(t * 19.0 + 17.0),
     29                0.5 + 0.5 * sin(t * 24.0 + 23.0),
     30                0.5 + 0.5 * sin(t * 37.0 + 12.0));
     31}
     32
    2633void main(void)
    2734{
     
    3239    if (newg > 0.0)
    3340        newb = 1.0;
    34     gl_FragColor = vec4(0.0, newg, 0.0, 1.0);
     41    gl_FragColor = vec4(rand_color(newg), 1.0);
    3542}
    3643
     
    4653
    4754[frag.hlsl]
     55
     56float3 rand_color(float t)
     57{
     58    return float3(0.5 + 0.5 * sin(t * 9.0 + 3.0),
     59                  0.5 + 0.5 * sin(t * 4.0 + 1.0),
     60                  0.5 + 0.5 * sin(t * 7.0 + 2.0));
     61}
    4862
    4963void main(in float2 pass_Position : TEXCOORD0,
Note: See TracChangeset for help on using the changeset viewer.