Difference between revisions of "love.graphics.drawInstanced"

m
m
Line 15: Line 15:
 
{{param|Mesh|mesh|The mesh to render.}}
 
{{param|Mesh|mesh|The mesh to render.}}
 
{{param|number|instancecount|The number of instances to render.}}
 
{{param|number|instancecount|The number of instances to render.}}
{{param|number|x (0)|The position to draw the object (x-axis).}}
+
{{param|number|x (0)|The position to draw the instances (x-axis).}}
{{param|number|y (0)|The position to draw the object (y-axis).}}
+
{{param|number|y (0)|The position to draw the instances (y-axis).}}
 
{{param|number|r (0)|Orientation (radians).}}
 
{{param|number|r (0)|Orientation (radians).}}
 
{{param|number|sx (1)|Scale factor (x-axis).}}
 
{{param|number|sx (1)|Scale factor (x-axis).}}

Revision as of 04:42, 7 January 2018

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


Draws many instances of a Mesh with a single draw call, using hardware geometry instancing.

Each instance can have unique properties (positions, colors, etc.) but will not by default unless a custom Shader along with either per-instance attributes or the love_InstanceID GLSL 3 vertex shader variable is used, otherwise they will all render at the same position on top of each other.

Instancing is not supported by some older GPUs that are only capable of using OpenGL ES 2 or OpenGL 2. Use love.graphics.getSupported to check.

Function

Synopsis

love.graphics.drawInstanced( mesh, instancecount, x, y, r, sx, sy, ox, oy, kx, ky )

Arguments

Mesh mesh
The mesh to render.
number instancecount
The number of instances to render.
number x (0)
The position to draw the instances (x-axis).
number y (0)
The position to draw the instances (y-axis).
number r (0)
Orientation (radians).
number sx (1)
Scale factor (x-axis).
number sy (sx)
Scale factor (y-axis).
number ox (0)
Origin offset (x-axis).
number oy (0)
Origin offset (y-axis).
number kx (0)
Shearing factor (x-axis).
number ky (0)
Shearing factor (y-axis).

Returns

Nothing.

Function

Synopsis

love.graphics.drawInstanced( mesh, instancecount, transform )

Arguments

Mesh mesh
The mesh to render.
number instancecount
The number of instances to render.
Transform transform
A transform object.

Returns

Nothing.

See Also


Other Languages