-
Notifications
You must be signed in to change notification settings - Fork 2
raylib.DrawMeshInstanced
JoeStrout edited this page Apr 29, 2026
·
2 revisions
Draw multiple mesh instances with material and different transforms
| Parameter | Default Value | Note |
|---|---|---|
| mesh | ||
| material | ||
| transforms |
None.
camera = {position:[0,8,14], target:[0,0,0], up:[0,1,0], fovy:45, projection:raylib.CAMERA_PERSPECTIVE}
raylib.InitWindow 800, 600, "DrawMeshInstanced"
mesh = raylib.GenMeshSphere(0.4, 8, 8)
mat = raylib.LoadMaterialDefault
// Build a list of 4 identity transforms (one per instance)
transforms = [raylib.MatrixIdentity, raylib.MatrixIdentity, raylib.MatrixIdentity, raylib.MatrixIdentity]
while not raylib.WindowShouldClose
raylib.BeginDrawing
raylib.ClearBackground raylib.RAYWHITE
raylib.BeginMode3D camera
raylib.DrawGrid 10, 1.0
raylib.DrawMeshInstanced mesh, mat, transforms, 4
raylib.EndMode3D
raylib.EndDrawing
end while
raylib.UnloadMesh mesh
raylib.CloseWindow