Assigning textures to a cube ?

Blitz3D Forums/Blitz3D Beginners Area/Assigning textures to a cube ?

OK, well maybe this will help...

; Paints a CreateCube() with different colours
; coded by BlackJumper

Graphics3D 640,480 
SetBuffer BackBuffer() 

Global camera=CreateCamera() 
light=CreateLight() 
RotateEntity light,90,0,0 

PositionEntity camera, 0, 0, -10

thecube = MakeCube()

While Not KeyDown( 1 ) 
	TurnEntity thecube, 1,1,1
RenderWorld 


Flip 

Wend 

End 


;====================================================================================================
Function MakeCube()
				shape = CreateCube()
				EntityFX shape, 2

			;	DebugLog "childern of cube = " + CountChildren(shape)
			;	For kids = 1 To CountChildren(shape)
			;	DebugLog "childern of cube = " + CountChildren(shape)
			;	kidshape = GetChild(shape, kids)
			;	For n = 1 To CountSurfaces(kids)
			;	DebugLog n
			;		surf = GetSurface(kidshape, n)
			;		DebugLog "triangles in prism = " + CountTriangles(surf)
			;		VertexColor surf, n, 255,0,0
			;	Next
			;	Next
			
			;	DebugLog "surfaces of cube = " + CountSurfaces(shape)

				For n = 1 To CountSurfaces(shape)
					surf = GetSurface(shape, n)
			;	DebugLog n + "    number vertices = " + CountVertices(surf)
				verts = CountVertices(surf)

				For v = 1 To CountVertices(surf)
					VertexColor surf, v, 255-(255.0/verts)*v,Abs((255.0/verts)*v-128),(255.0/verts)*v
				Next
				Next
				
				UpdateNormals shape
	
	Return shape
	
End Function
;====================================================================================================


.... shows how to access individual faces (sortof)