Re: [AD] shader addon questions

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


On Sun Jan 15, 2012, Trent Gamblin wrote:
> 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.

Or if we're into the explosion of API... Have two, al_set_shader_float_vector, 
and al_set_shader_float_vectors ?


> ---------------------------------------------------------------------------
> --- RSA(R) Conference 2012
> Mar 27 - Feb 2
> Save $400 by Jan. 27
> Register now!
> http://p.sf.net/sfu/rsa-sfdev2dev2


-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx




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