Difference between revisions of "Shader:sendColor"

m (Add missing full stop.)
m (Other Languages: fixed i18n (Shader:send -> Shader:sendColor))
Line 35: Line 35:
 
{{#set:Description=Sends one or more colors to the shader.}}
 
{{#set:Description=Sends one or more colors to the shader.}}
 
== Other Languages ==
 
== Other Languages ==
{{i18n|Shader:send}}
+
{{i18n|Shader:sendColor}}

Revision as of 13:59, 4 October 2016

Available since LÖVE 0.10.0
This function is not supported in earlier versions.

Sends one or more colors to a special (extern / uniform) vec3 or vec4 variable inside the shader. The color components must be in the range of [0, 255], unlike Shader:send. The colors are gamma-corrected if global gamma-correction is enabled.

Extern variables must be marked using the extern keyword, e.g.

extern vec4 Color;

The corresponding sendColor call would be

shader:sendColor("Color", {r, g, b, a})


Extern variables can be accessed in both the Vertex and Pixel stages of a shader, as long as the variable is declared in each.

Function

Synopsis

Shader:sendColor( name, color, ... )

Arguments

string name
The name of the color extern variable to send to in the shader.
table color
A table with red, green, blue, and optional alpha color components in the range of [0, 255] to send to the extern as a vector.
table ...
Additional colors to send in case the extern is an array. All colors need to be of the same size (e.g. only vec3's).

Returns

Nothing.

See Also

Other Languages