Skip to content

BPL_BL_Canvas

BurrowLib 0.2.0, in the palette under BurrowLib › Canvas.

Drawing into a render target from a Blueprint.

A render target’s canvas draws every call on its own, so a picture made of many small draws costs a render draw each, and a thousand a frame is enough to stall the game. Instead, collect the picture as triangles in one array with AddRect, and hand the whole array to DrawTriangles, which draws it in a single call.

Adds a filled rectangle to a batch, as two triangles of one colour. x and y are its top left corner, in pixels of the render target.

Draws a batch of triangles into a render target in one call. It draws over what the target already holds, so a picture that changes should start with a rectangle covering it.

Paint collects a dark background and an orange square as triangles, then draws them into the render target in one call. Set Target on the placed actor to the render target to draw into.

An Actor Blueprint, BP_CanvasPicture, with:

  • a variable Tris, Array of Canvas UVTri Structures
  • a variable Target, Texture Render Target 2D Object Reference, instance editable

Function Paint

Event Graph