Skip to content

CreateBrush

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions
Blitz3D

CreateBrush

CreateBrush:Int32 red:Float32=255, green:Float32=255, blue:Float32=255
Parameter Mode Type Default Description
red In Float32 255 Red part, 0 to 255. Defaults to 255.
green In Float32 255 Green part, 0 to 255. Defaults to 255.
blue In Float32 255 Blue part, 0 to 255. Defaults to 255.

Returns: A brush handle.

Description

Makes a brush: a bundle of look settings (color, alpha, shininess, blend mode, effects and up to eight textures) that you can apply in one go with PaintEntity, PaintMesh or PaintSurface. The new brush is opaque white with no texture unless you pass a color.

Brushes are the way to give different surfaces of one mesh a different look, because EntityColor and EntityAlpha affect the whole entity at once.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
CameraClsColor camera, 70, 100, 160
light = CreateLight()
RotateEntity light, 40, 30, 0

mesh = CreateMesh()
a = CreateSurface(mesh)
AddVertex a, -1, 1, 0 : AddVertex a, 1, 1, 0 : AddVertex a, 1, -1, 0 : AddVertex a, -1, -1, 0
AddTriangle a, 0, 1, 2 : AddTriangle a, 0, 2, 3
b = CreateSurface(mesh)
AddVertex b, 1, 1, 0 : AddVertex b, 3, 1, 0 : AddVertex b, 3, -1, 0 : AddVertex b, 1, -1, 0
AddTriangle b, 0, 1, 2 : AddTriangle b, 0, 2, 3
UpdateNormals mesh

red = CreateBrush(220, 60, 50)
BrushShininess red, 0.8
green = CreateBrush(60, 190, 90)
PaintSurface a, red
PaintSurface b, green
FreeBrush red
FreeBrush green

PositionEntity mesh, -1, 0, 6
TurnEntity mesh, 0, -20, 0
RenderWorld
Flip
WaitKey

Media

CreateBrush

Related Commands

BrushAlpha, BrushBlend, BrushColor, BrushFX, FreeBrush, GetEntityBrush, GetSurfaceBrush, LoadBrush

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally