rearrange to be less than 80col

This commit is contained in:
Øyvind Kolås 2008-03-10 23:09:28 +00:00
parent aa1e89cc92
commit b6cc7c1249

View File

@ -21,16 +21,17 @@ typedef struct
* sample shaders * sample shaders
*/ */
/* FRAGMENT_SHADER_BEGIN: generate boilerplate with a local vec4 color already initialized, /* FRAGMENT_SHADER_BEGIN: generate boilerplate with a local vec4 color already
* from a sampler2DRect in a variable tex. * initialized, from a sampler2DRect in a variable tex.
*/ */
#define FRAGMENT_SHADER_BEGIN \ #define FRAGMENT_SHADER_BEGIN \
"uniform sampler2DRect tex;" \ "uniform sampler2DRect tex;" \
"void main (){" \ "void main (){" \
" vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));" " vec4 color = texture2DRect (tex, vec2(gl_TexCoord[0].st));"
/* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly blended /* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly
* with the gl specified color (makes the opacity of actors work correctly). * blended with the gl specified color (makes the opacity of actors work
* correctly).
*/ */
#define FRAGMENT_SHADER_END \ #define FRAGMENT_SHADER_END \
" gl_FragColor = color;" \ " gl_FragColor = color;" \
@ -42,7 +43,8 @@ static ShaderSource shaders[]=
{"brightness-contrast", {"brightness-contrast",
"uniform float brightness, contrast;" "uniform float brightness, contrast;"
FRAGMENT_SHADER_BEGIN FRAGMENT_SHADER_BEGIN
" color.rgb = (color.rgb - vec3(0.5, 0.5, 0.5)) * contrast + vec3 (brightness + 0.5, brightness + 0.5, brightness + 0.5);" " color.rgb = (color.rgb - vec3(0.5, 0.5, 0.5)) * contrast + "
"vec3 (brightness + 0.5, brightness + 0.5, brightness + 0.5);"
FRAGMENT_SHADER_END FRAGMENT_SHADER_END
}, },
@ -153,12 +155,13 @@ button_release_cb (ClutterActor *actor,
shader = clutter_shader_new (); shader = clutter_shader_new ();
error = NULL; error = NULL;
g_object_set (G_OBJECT (shader), "fragment-source", shaders[shader_no].source, NULL); g_object_set (G_OBJECT (shader),
"fragment-source", shaders[shader_no].source, NULL);
/* try to bind the shader, provoking an error we catch if there is issues /* try to bind the shader, provoking an error we catch if there is issues
* with the shader sources we've provided. At a later stage it should be possible to * with the shader sources we've provided. At a later stage it should be
* iterate through a set of alternate shader sources (glsl -> asm -> cg?) and the one * possible to iterate through a set of alternate shader sources (glsl ->
* that succesfully compiles is used. * asm -> cg?) and the one that succesfully compiles is used.
*/ */
clutter_shader_bind (shader, &error); clutter_shader_bind (shader, &error);