Re: [AD] shader addon questions

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


On Sun, 15 Jan 2012 10:31:43 -0700
Thomas Fjellstrom <tfjellstrom@xxxxxxxxxx> wrote:
> On Sun Jan 15, 2012, Trent Gamblin wrote:
> > On 2012-01-15, at 7:40 AM, Elias Pschernig wrote:
> > > 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 ?
> 

Well, in OpenGL the function is called glUniform[1234][if][v].

al_set_shader_float is the same as glUniform1f.

al_set_shader_float_vector is the same as glUniform[1234]fv.

So I assume your two functions would look like this:

al_set_shader_float_vector(shader, name, elem_size, ...)

al_set_shader_float_vectors(shader, name, elem_size, pointer, num_elems)

So in the end where in OpenGL you would do:

glUniform1f(1)
glUniform3f(2, 3, 4)
glUniform2fv(3, {5, 6, 7, 8, 9, 0})

The current API would be:

al_set_shader_float(1)
al_set_shader_float_vector(3, {2, 3, 4}, 1)
al_set_shader_float_vector(2, {5, 6, 7, 8, 9, 0}, 3)

And the new API would be:

al_set_shader_float(1)
al_set_shader_float_vector(3, 2, 3, 4)
al_set_shader_float_vectors(2, {5, 6, 7, 8, 9, 0}, 3)

I think it makes sense.




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