Getting started
Install the addon and draw the first four shapes.
Install
- Copy the
addons/geomfolder into your project. - Restart Godot.
There is no plugin to enable. If GeomDraw is not recognized afterwards, check that
Godot is 4.6 or newer — the addon refuses to load on older versions rather than
failing halfway.
Draw something
GeomDraw is a global, available everywhere without an autoload. Call it from
_process; whatever you draw appears that frame and is gone the next, the same
way draw_line works inside _draw but without needing to be inside _draw.
extends Node2D
## The first thing to try: four shapes, drawn from code.
func _process(_delta: float) -> void:
# Draw is a global. There is no autoload to add and nothing to instance --
# whatever you draw appears this frame and is gone the next.
GeomDraw.reset_all_draw_states()
GeomDraw.color = Color(0.42, 0.85, 1.0)
GeomDraw.thickness = 6.0
GeomDraw.disc_2d(Vector2(160, 150), 60.0)
GeomDraw.ring_2d(Vector2(320, 150), 60.0)
GeomDraw.regular_polygon_2d(Vector2(480, 150), 60.0, 6)
GeomDraw.line_2d(Vector2(100, 260), Vector2(540, 260))
Three things in that snippet are worth naming.
reset_all_draw_states() puts the draw state back to its defaults. The state is
global and persists between calls, so a thickness set by another script earlier
in the frame is still set when yours runs. Resetting at the top of _process
makes a block of drawing independent of whatever ran before it.
color and thickness are set once and apply to every call after them. That is
what makes the batching work: consecutive calls sharing a shader merge into one
draw call, so those four shapes cost fewer draw calls than shapes.
The _2d suffix marks the canvas calls. The 3D versions have the same names
without it and take Vector3.
Next
- Shapes, and the state that styles them
- Dashing, gradients, and thickness spaces