Re: [AD] shader addon questions |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sun, 15 Jan 2012 09:17:26 -0700
Trent Gamblin <trent@xxxxxxxxxx> 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).
Hm, I'm still somewhat confused. If I always have to call
al_set_shader for each shader I'm using before calling al_use_shader
on it - couldn't we remove the function and simply do whatever it does
in al_use_shader instead?
> > 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.
I think I see. So basically al_draw_prim is limited to those 3
attributes. I think in the final API we'll want a way to set arbitrary
attributes. But I'll need to think about it more.