* tests/test-fbo.c: (make_shader):

* tests/test-shader.c: (main): multiply the resulting gl_FragColor
with gl_Color before being done to take opacity into account in the
GLSL fragments.
This commit is contained in:
Øyvind Kolås 2008-02-04 13:05:16 +00:00
parent 1fe08217b7
commit 545e323ec1
3 changed files with 16 additions and 24 deletions

View File

@ -1,3 +1,10 @@
2008-02-04 Øyvind Kolås <pippin@o-hand.com>
* tests/test-fbo.c: (make_shader):
* tests/test-shader.c: (main): multiply the resulting gl_FragColor
with gl_Color before being done to take opacity into account in the
GLSL fragments.
2008-02-04 Øyvind Kolås <pippin@o-hand.com> 2008-02-04 Øyvind Kolås <pippin@o-hand.com>
* clutter/clutter-actor.[ch]: added clutter_actor_get_shader and * clutter/clutter-actor.[ch]: added clutter_actor_get_shader and

View File

@ -57,7 +57,7 @@ make_shader(void)
" }" " }"
"" ""
" gl_FragColor = color / float(count);" " gl_FragColor = color / float(count);"
" gl_FragColor = gl_FragColor * gl_Color;"
"}", "}",
-1 -1
); );

View File

@ -28,6 +28,7 @@ static ShaderSource shaders[]=
" pend_s4_result.y = (pend_s4_result.y - 0.5)*contrast + brightness + 0.5;" " pend_s4_result.y = (pend_s4_result.y - 0.5)*contrast + brightness + 0.5;"
" pend_s4_result.z = (pend_s4_result.z - 0.5)*contrast + brightness + 0.5;" " pend_s4_result.z = (pend_s4_result.z - 0.5)*contrast + brightness + 0.5;"
" gl_FragColor = pend_s4_result;" " gl_FragColor = pend_s4_result;"
" gl_FragColor = gl_FragColor * gl_Color;"
"}", "}",
}, },
{"box-blur", {"box-blur",
@ -49,31 +50,9 @@ static ShaderSource shaders[]=
" }" " }"
"" ""
" gl_FragColor = color / float(count);" " gl_FragColor = color / float(count);"
" gl_FragColor = gl_FragColor * gl_Color;"
"}" "}"
}, },
{"brightness-contrast.asm",
"!!ARBfp1.0\n"
"PARAM brightness = program.local[0];\n"
"PARAM contrast = program.local[1];\n"
"\n"
"TEMP R0;\n"
"TEX R0, fragment.texcoord[0], texture[0], RECT;\n"
"ADD R0.z, R0, -0.5;\n"
"MUL R0.z, R0, contrast.x;\n"
"ADD R0.z, R0, brightness.x;\n"
"ADD R0.y, R0, -0.5;\n"
"ADD R0.x, R0, -0.5;\n"
"MUL R0.y, R0, contrast.x;\n"
"MUL R0.x, R0, contrast.x;\n"
"ADD R0.y, R0, brightness.x;\n"
"ADD R0.x, R0, brightness.x;\n"
"ADD result.color.z, R0, 0.5;\n"
"ADD result.color.y, R0, 0.5;\n"
"ADD result.color.x, R0, 0.5;\n"
"MOV result.color.w, R0;\n"
"END ",
},
{"invert", {"invert",
"uniform sampler2DRect tex;\n" "uniform sampler2DRect tex;\n"
@ -82,6 +61,7 @@ static ShaderSource shaders[]=
" vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));\n" " vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));\n"
" gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0) - color;\n" " gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0) - color;\n"
" gl_FragColor.a = color.a;\n" " gl_FragColor.a = color.a;\n"
" gl_FragColor = gl_FragColor * gl_Color;"
"}" "}"
}, },
{"brightness-contrast", {"brightness-contrast",
@ -96,6 +76,7 @@ static ShaderSource shaders[]=
" color.g = (color.g - 0.5) * contrast + brightness + 0.5;" " color.g = (color.g - 0.5) * contrast + brightness + 0.5;"
" color.b = (color.b - 0.5) * contrast + brightness + 0.5;" " color.b = (color.b - 0.5) * contrast + brightness + 0.5;"
" gl_FragColor = color;" " gl_FragColor = color;"
" gl_FragColor = gl_FragColor * gl_Color;"
"}", "}",
}, },
{"gray", {"gray",
@ -108,6 +89,7 @@ static ShaderSource shaders[]=
" color.g = avg;" " color.g = avg;"
" color.b = avg;" " color.b = avg;"
" gl_FragColor = color;" " gl_FragColor = color;"
" gl_FragColor = gl_FragColor * gl_Color;"
"}", "}",
}, },
{"combined-mirror", {"combined-mirror",
@ -122,6 +104,7 @@ static ShaderSource shaders[]=
" color.b = avg;" " color.b = avg;"
" color = (color + colorB)/2.0;" " color = (color + colorB)/2.0;"
" gl_FragColor = color;" " gl_FragColor = color;"
" gl_FragColor = gl_FragColor * gl_Color;"
"}", "}",
}, },
{NULL, NULL} {NULL, NULL}
@ -276,6 +259,8 @@ main (gint argc,
g_signal_connect (actor, "button-release-event", g_signal_connect (actor, "button-release-event",
G_CALLBACK (button_release_cb), NULL); G_CALLBACK (button_release_cb), NULL);
/*clutter_actor_set_opacity (actor, 0x77);*/
/* Show everying ( and map window ) */ /* Show everying ( and map window ) */
clutter_actor_show_all (stage); clutter_actor_show_all (stage);