glLight is glLightfv, isn t it?

Started by Itun, April 06, 2011, 17:23:54

Previous topic - Next topic

Itun

If it is, why have you change the name?


spasi

Quote from: Itun on April 06, 2011, 17:23:54If it is, why have you change the name?

We have done this for all *v methods that work with pointers at the C level. The C function that will be called depends on the NIO buffer argument's type of the corresponding Java method. For example:

glLight(int light, int pname, FloatBuffer params) will call glLightfv
glLight(int light, int pname, IntBuffer params) will call glLightiv

As for the why, I guess because it looks better, it's less typing and the {fi}v postfix doesn't really offer anything. Method overloading is nice.

We could have done the same for scalar arguments (e.g. glLightf(int light, int pname, float param)), but that would be error-prone because of the implicit type conversions that Java allows.