effects: Check before using the cogl_shader_* API

Since BlurEffect and DesaturateEffect are using the shader API
implicitly and not using ClutterShaderEffect, we need to check if the
underlying GL implementation supports the GLSL shading language and warn
if not.
This commit is contained in:
Emmanuele Bassi 2010-08-11 17:25:17 +01:00
parent 9ab83cebfd
commit d10ebe9fca
2 changed files with 24 additions and 0 deletions

View File

@ -137,6 +137,18 @@ clutter_blur_effect_pre_paint (ClutterEffect *effect)
if (self->actor == NULL)
return FALSE;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
/* if we don't have support for GLSL shaders then we
* forcibly disable the ActorMeta
*/
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
"or the current GL driver does not implement support "
"for the GLSL shading language.");
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
return FALSE;
}
clutter_actor_get_allocation_box (self->actor, &allocation);
clutter_actor_box_get_size (&allocation, &width, &height);

View File

@ -132,6 +132,18 @@ clutter_desaturate_effect_pre_paint (ClutterEffect *effect)
if (self->actor == NULL)
return FALSE;
if (!clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
{
/* if we don't have support for GLSL shaders then we
* forcibly disable the ActorMeta
*/
g_warning ("Unable to use the ShaderEffect: the graphics hardware "
"or the current GL driver does not implement support "
"for the GLSL shading language.");
clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (effect), FALSE);
return FALSE;
}
factor = (float) self->factor;
if (self->shader == COGL_INVALID_HANDLE)