[AD] More default shaders

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I think the shaders are a very cool concept but are hard for newbies to start with. I think the shader addon should provide a whole slew of default shaders for nice effects with an easy API that doesn't leak the implementation details (like the current al_get_glsl_*_shader do). Something that would recapitulate the effects you could get in A4 using the blenders (see http://alleg.sourceforge.net/stabledocs/en/alleg020.html for a list), but possibly add a number of other useful ones, like blurring or glass.

One simple API idea would be to just do this:

ALLEGRO_SHADER* al_create_default_shader();
ALLEGRO_SHADER* al_create_light_shader();
//etc

After being created, the user would interact with the shader the usual way (the various variables, such as colors, will be set using the uniform setting syntax we already have).

It might be interesting to simplify that even further and mimic the A4 API more accurately (ignore the names, no thought was put into them):

ALLEGRO_EFFECT_STATE* al_create_effect_state();

al_use_default_effect(ALLEGRO_EFFECT_STATE* state);
al_use_light_effect(ALLEGRO_EFFECT_STATE* state, ALLEGRO_COLOR light);

Obviously this is inflexible, but it is exactly designed for ease of use by beginners. The old API is unaffected by this proposed change (even the al_get_default_glsl_*_shader have their use, just not this use).

-SL




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/