dxCreateBrush%(red#,green#,blue#)

Parameters

red# (optional) - brush red value
green# (optional) - brush green value
blue# (optional) - brush blue value

Description

Creates a brush and returns a brush handle.

The optional green, red and blue values allow you to set the colour of the brush. Values should be in the range 0-255. If omitted the values default to 255.

A brush is a collection of properties such as Colour, Alpha, Shininess, Texture etc that are all stored as part of the brush. Then, all these properties can be applied to an entity, mesh or surface at once just by using dxPaintEntity, PaintMesh or dxPaintSurface.

When creating your own mesh, if you wish for certain surfaces to look differently from one another, then you will need to use brushes to paint individual surfaces. Using commands such as dxEntityColor, dxEntityAlpha will apply the effect to all surfaces at once, which may not be what you wish to achieve.

See also: LoadBrush.

Example

; dxCreateBrush Example
; -------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()

light=dxCreateLight()
dxRotateEntity light,90,0,0

cube=dxCreateCube()
dxPositionEntity cube,0,0,5

; Load texture
tex=dxLoadTexture("media/b3dlogo.jpg")

; Create brush
brush=dxCreateBrush()

; Apply texture to brush
dxBrushTexture brush,tex

; And some shininess
dxBrushShininess brush,1

; Paint mesh with brush
PaintMesh cube,brush

While Not dxKeyDown( 1 )

pitch#=0
yaw#=0
roll#=0

If dxKeyDown( 208 )=True Then pitch#=-1
If dxKeyDown( 200 )=True Then pitch#=1
If dxKeyDown( 203 )=True Then yaw#=-1
If dxKeyDown( 205 )=True Then yaw#=1
If dxKeyDown( 45 )=True Then roll#=-1
If dxKeyDown( 44 )=True Then roll#=1

dxTurnEntity cube,pitch#,yaw#,roll#

dxRenderWorld
dxFlip

Wend

End

Index