Re: [AD] shader addon questions

[ Thread Index | Date Index | More Archives ]

On 2012-01-15, at 7:40 AM, Elias Pschernig wrote:
> I tried documenting the shader addon a bit but there's a few things
> I've been wondering about.
> 1. What does al_set_shader do? Shouldn't al_use_shader be enough?

al_set_shader tells Allegro to use the shader internally. It will set matrices when you change transforms, set shader variables automatically. al_use_shader is used just before drawing and just after drawing. al_use_shader has to be called after setting shader variables (either automatic or by the user), and not before (though some backends it doesn't matter).

> 2. what is the difference between these three functions?
> al_set_shader_vertex_array
> al_set_shader_color_array
> al_set_shader_texcoord_array

Hm.. well I think those functions were accidentally left in and may not be useful, and indeed could be replaced. They used to be required before Allegro itself handled everything. The reason there were 3 is that they each set a specially named variable in the shader.

> 3. al_set_shader_float_vector
> If I understood correctly, this either sets an *array of floats* if
> elem_size is 1 or alternatively an *array of float vectors* if
> elem_size is 2, 3 or 4. So the name is misleading. My suggestion would
> be to rename it to al_set_shader_float_array (since
> al_set_shader_array_of_float_vectors would be a bit long).

I have no problem with that.

Mail converted by MHonArc 2.6.19+