Procedural geometry generation

    This is the most common helper. is a class you can instantiate to generate Meshes, specifically Mesh Surfaces.

    It has a similar API to OpenGL 1.x, and it’s meant for static content. This means, the mesh is generated once and then used.

    Here is a simple example of how to use it to add a single triangle.

    Just explore the APIs and the possibilities.

    Unlike SurfaceTool, is an actual node. It’s similar in the “OpenGL 1.x” style API, but it’s actually designed to create content on the fly and modify it every frame efficiently.

    Generating complex geometry (several thousand vertices) with this node is inefficient, even if it’s done only once. Instead, ImmediateGeometry is designed to generate simple geometry that changes every frame.

    GDScript

    Lastly, the final way to do this is to create arrays themselves. This is the most efficient way to create static geometry, and is only recommended when SurfaceTool is not fast enough.

    Similar code as before, but draw a square using indices: