b2dMeshFaceR

Category: 2D Overlay

Syntax:

b2dMeshFaceR:Int(handle:Int, face:Int)


Parameters

Returns

Red, 0..255



Summary

The red part of a face's base colour, from the material it was given in the modelling program. b2dMeshFaceG and b2dMeshFaceB give green and blue.

Use these for a model with no texture (b2dMeshTexture returns 0): set the colour, optionally darkened by how the face points towards a light, and draw the face with b2dDrawQuadDepth.

Returns 255 (white) for a mesh saved without material colours, and for an unknown handle or face, so an old untextured model still draws as something.

View detailed documentation online



Example
b2dSetColor(b2dMeshFaceR(mesh, f), b2dMeshFaceG(mesh, f), b2dMeshFaceB(mesh, f))
b2dDrawQuadDepth(sxA,syA,dA, sxB,syB,dB, sxC,syC,dC, sxD,syD,dD, 1)

See examples/Runtime/30 - Meshes.


BambooBasic © 2026 Michael Denathorn