Skip to content

VertexColor

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

VertexColor

VertexColor:Void surface:Int32, index:Int32, red:Float32, green:Float32, blue:Float32, alpha:Float32=1
Parameter Mode Type Default Description
surface In Int32 required Surface handle.
index In Int32 required Index of the vertex, from 0.
red In Float32 required Red part, 0 to 255.
green In Float32 required Green part, 0 to 255.
blue In Float32 required Blue part, 0 to 255.
alpha In Float32 1 Opacity, 0 to 1. Defaults to 1.

Description

Sets the color of a vertex and its alpha. The color is blended smoothly across each triangle between its three vertices, which gives gradients and cheap baked lighting. It is multiplied with the entity color. Colors go from 0 to 255 and the alpha from 0, invisible, to 1, solid. The values can be floats and are kept exactly, instead of being rounded to whole numbers. Alpha per vertex needs EntityFX 32 on the entity in the original.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 0, 0, -4
mesh = CreateMesh()
surf = CreateSurface(mesh)
a = AddVertex(surf, -1.5, -1.2, 0)
b = AddVertex(surf, 0, 1.4, 0)
c = AddVertex(surf, 1.5, -1.2, 0)
AddTriangle surf, a, b, c
VertexColor surf, a, 255, 40, 40
VertexColor surf, b, 40, 255, 40
VertexColor surf, c, 40, 40, 255
; Show the vertex colors without light.
EntityFX mesh, 1 + 2
RenderWorld
Flip
WaitKey

Media

VertexColor

Related Commands

VertexAlpha, VertexBlue, VertexCoords, VertexGreen, VertexNormal, VertexNX, VertexNY, VertexNZ

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally