I want to write a generic function that passes a generic parameter to a function that has several overloads. The C++ equivalent would be this. Here is what I tried:
public void setUniform1<T>(int loc, T value) {
GL.Uniform1(loc, value);
}
However this gives me the error
error CS1503: Argument 2: cannot convert from 'T' to 'double'
GL.Uniform1
takes several types for the value paramter and I guess double is the first overload, that's why it's trying to convert to double.
So how do I do this?