Changeset 2092 for trunk/tools


Ignore:
Timestamp:
Nov 19, 2012, 1:45:47 AM (7 years ago)
Author:
sam
Message:

neercs: do not pass the texture coordinates from the application to
the GL server; instead, simply deduce them from the vertex coordinates
and interpolate them in the fragment shader.

Location:
trunk/tools/neercs/video
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/neercs/video/blurh.lolfx

    r1928 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D texture;
     
    1923{
    2024    vec4 total = vec4(0.0);
    21     vec2 p = gl_TexCoord[0].xy;
     25    vec2 p = pass_TexCoord;
    2226    float mask = 2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
    2327    float b = radius.x+radius.y*mask;
  • trunk/tools/neercs/video/blurv.lolfx

    r1928 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D texture;
     
    1923{
    2024    vec4 total = vec4(0.0);
    21     vec2 p = gl_TexCoord[0].xy;
     25    vec2 p = pass_TexCoord;
    2226    float mask = 2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
    2327    float b = radius.x+radius.y*mask;
  • trunk/tools/neercs/video/color.lolfx

    r2007 r2092  
    66{
    77    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
    98}
    109
     
    2120void main(void)
    2221{
    23     vec2 p = gl_FragCoord.xy/screen_size.xy;
     22    vec2 p = gl_FragCoord.xy / screen_size.xy;
    2423    vec3 c = texture2D(texture,p).xyz;
    2524
  • trunk/tools/neercs/video/copper.lolfx

    r1978 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D texture;
     
    2125void main(void)
    2226{
    23     vec2 p = gl_TexCoord[0].xy;
     27    vec2 p = pass_TexCoord;
    2428    vec3 source = texture2D(texture, p).xyz;
    2529
  • trunk/tools/neercs/video/glow.lolfx

    r1928 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D glow;
     
    1923void main(void)
    2024{
    21     gl_FragColor = texture2D(source,gl_TexCoord[0].xy)*mix.x+texture2D(glow,gl_TexCoord[0].xy)*mix.y;
     25    gl_FragColor = texture2D(source, pass_TexCoord) * mix.x
     26                 + texture2D(glow, pass_TexCoord) * mix.y;
    2227}
     28
  • trunk/tools/neercs/video/mirror.lolfx

    r2039 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D texture;
     
    1923void main(void)
    2024{
    21     vec2 p = gl_TexCoord[0].xy;
     25    vec2 p = pass_TexCoord;
    2226    vec3 s = texture2D(texture, p).xyz;
    2327
  • trunk/tools/neercs/video/noise.lolfx

    r2003 r2092  
    55void main()
    66{
    7     gl_Position=gl_Vertex;
    8     gl_TexCoord[0]=gl_MultiTexCoord0;
     7    gl_Position = gl_Vertex;
    98}
    109
     
    2019uniform vec3 retrace;
    2120
    22 float rand(in vec2 p,in float t,in float v)
     21float rand(in vec2 p, in float t, in float v)
    2322{
    24     return fract(sin(dot(p+mod(t,1.0),vec2(12.9898,78.2333)))*v);
     23    return fract(sin(dot(p + mod(t, 1.0), vec2(12.9898, 78.2333))) * v);
    2524}
    2625
  • trunk/tools/neercs/video/postfx.lolfx

    r2055 r2092  
    55void main()
    66{
    7     gl_Position=gl_Vertex;
    8     gl_TexCoord[0]=gl_MultiTexCoord0;
     7    gl_Position = gl_Vertex;
    98}
    109
  • trunk/tools/neercs/video/radial.lolfx

    r2007 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D texture;
     
    2630void main(void)
    2731{
    28     vec2 p = -1.0+2.0*gl_TexCoord[0].xy;
     32    vec2 p = -1.0 + 2.0 * pass_TexCoord;
    2933    vec2 s = p;
    3034    vec3 source=deform(s);
  • trunk/tools/neercs/video/remanence.lolfx

    r1973 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1214
    1315#version 120
     16
     17varying vec2 pass_TexCoord;
    1418
    1519uniform sampler2D source;
     
    1923void main(void)
    2024{
    21     vec4 old_color = texture2D(buffer, gl_TexCoord[0].xy);
    22     vec4 new_color = texture2D(source, gl_TexCoord[0].xy);
     25    vec4 old_color = texture2D(buffer, pass_TexCoord);
     26    vec4 new_color = texture2D(source, pass_TexCoord);
    2327
    2428    /* The old way */
  • trunk/tools/neercs/video/render.cpp

    r2059 r2092  
    6868float fx_angle;            // current angle
    6969/* fs_quad variable */
    70 float fs_quad_vtx[] = {-1.0f, 1.0f, 0, 1.0f, -1.0f, -1.0f, 0, 1.0f, 1.0f, -1.0f, 0, 1.0f, 1.0f, 1.0f, 0, 1.0f};
    71 float fs_quad_tex[] = {0, 1.0f, 0, 0, 1.0f, 0, 1.0f, 1.0f};
     70float fs_quad_vtx[] =
     71{
     72    -1.0f,  1.0f, 0, 1.0f,
     73    -1.0f, -1.0f, 0, 1.0f,
     74     1.0f, -1.0f, 0, 1.0f,
     75     1.0f,  1.0f, 0, 1.0f
     76};
    7277/* flash variable */
    7378bool flash_flag = false;   // flag
     
    14721477    glMatrixMode(GL_MODELVIEW);
    14731478
    1474     fx_angle=main_angle-part_angle;
     1479    fx_angle = main_angle - part_angle;
    14751480}
    14761481
     
    14851490    glEnableClientState(GL_VERTEX_ARRAY);
    14861491    glVertexPointer(4, GL_FLOAT, 0, fs_quad_vtx);
    1487 
    1488     glEnableClientState(GL_TEXTURE_COORD_ARRAY);
    1489     glTexCoordPointer(2, GL_FLOAT, 0, fs_quad_tex);
    14901492
    14911493    if (m_shader_copper)
     
    17241726
    17251727    glDisableClientState(GL_VERTEX_ARRAY);
    1726     glDisableClientState(GL_TEXTURE_COORD_ARRAY);
    17271728}
    17281729
  • trunk/tools/neercs/video/simple.lolfx

    r1928 r2092  
    33#version 120
    44
     5varying vec2 pass_TexCoord;
     6
    57void main()
    68{
    79    gl_Position = gl_Vertex;
    8     gl_TexCoord[0] = gl_MultiTexCoord0;
     10    pass_TexCoord = vec2(0.5, 0.5) + 0.5 * gl_Vertex.xy;
    911}
    1012
     
    1315#version 120
    1416
     17varying vec2 pass_TexCoord;
     18
    1519uniform sampler2D texture;
    1620
    1721void main(void)
    1822{
    19     gl_FragColor = texture2D(texture, gl_TexCoord[0].xy);
     23    gl_FragColor = texture2D(texture, pass_TexCoord);
    2024}
    2125
Note: See TracChangeset for help on using the changeset viewer.