vertex colors?

Blitz3D Forums/Blitz3D Beginners Area/vertex colors?

How does blitz decide how to color the texture/cube when you enable vertex colors? Does it use uv coordinates?

Graphics3D 800,600,0,2
SeedRnd(MilliSecs())
cube = CreateCube()
EntityFX(cube,2)
For i = 1 To CountSurfaces(cube)
	surf = GetSurface(cube,i)
	For i = 1 To CountVertices(surf)
		VertexColor(surf,i,Rand(0,255),Rand(0,255),Rand(0,255))
	Next
Next
campiv = CreatePivot()
camera = CreateCamera(campiv)
MoveEntity(camera,0,0,-10)
RotateEntity(cube,45,45,45)

While Not KeyDown(1)
	If KeyDown(203) Then TurnEntity(campiv,0,1,0)
	If KeyDown(205) Then TurnEntity(campiv,0,-1,0)
	If KeyDown(200) Then TurnEntity(campiv,1,0,0)
	If KeyDown(208) Then TurnEntity(campiv,-1,0,0)
	RenderWorld()
	Flip()
Wend


Not sure if I understand what you mean, but when you enable vertex colors, each vertex gets its own color. A vertex is a point in 3d space. The triangles between the vertices are shaded between three colors, one for each corner.

The default vertex colors are 255 but you can change them in the 3d app if you create your own mesh.

Then howe come on each of the faces of the cube, if you take one vertex, each face has a different color coming from it? One vertex seems to have multiple colors, one for each traingle it is attached to.

Then that mesh is unwelded, that means that each triangle has its own vertices. Two vertices can be exactly in the same spot.

That clears things up a bit....trying to test with Blitz cubes won't work...neither will most any other blitz mesh, they all seem unwelded :(

Thanks everyone!

Here is a MeshWeld function from the archives: http://www.blitzbasic.com/codearcs/codearcs.php?code=1377

I will just make my own cubes...not that hard. Even with his stuff it still does not seem to work 100%. This way I will have more control over the cube anyways.