Pass:getCanvas

Edit

Returns the Pass's canvas, or nil if the Pass doesn't have a canvas. The canvas is a set of textures that the Pass will draw to when it's submitted.



Arguments

None

Returns

NameTypeDescription
canvastable The canvas. Numeric keys will contain the color Textures, along with the following keys:
.depth* A Texture or TextureFormat with the depth buffer.
.samplesnumber The number of multisamples used for antialiasing (either 1 or 4).

This function returns nil when a canvas hasn't been set.

Arguments

None

Returns

Nothing

Notes

If the Pass has multiple color textures, a fragment shader should be used to write a different color to each texture. Here's an example that writes red to the first texture and blue to the second texture:

// Declare an output variable for the second texture
layout(location = 1) out vec4 secondColor;

vec4 lovrmain() {
  secondColor = vec4(0, 0, 1, 1);
  return vec4(1, 0, 0, 1);
}

See also