how to use vertexcolor ?
Blitz3D Forums/Blitz3D Programming/how to use vertexcolor ?
| ||
I try to put color on triangle of an object with the "vertexcolor" command but my object is always blank. is someone can help me ? hereafter the code : Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() AmbientLight 255,255,255 objet = CreateMesh() surf=CreateSurface(objet) v0=AddVertex(surf,0,0,0) ; bottom corner 1 v1=AddVertex(surf,0,0,1) ; bottom corner 2 v2=AddVertex(surf,4,0,1) ; bottom corner 3 v3=AddVertex(surf,4,0,0) ; bottom corner 4 v4=AddVertex(surf,0,2,0) ; top corner 1 v5=AddVertex(surf,0,2,1) ; top corner 2 t0=AddTriangle(surf,v0,v3,v2) ; bottom triangle 1 t1=AddTriangle(surf,v0,v2,v1) ; bottom triangle 2 t2=AddTriangle(surf,v0,v4,v3) ; front triangle t3=AddTriangle(surf,v1,v2,v5) ; back triangle t4=AddTriangle(surf,v0,v1,v5) ; side triangle 1 t5=AddTriangle(surf,v0,v5,v4) ; side triangle 2 t6=AddTriangle(surf,v2,v4,v5) ; top triangle 1 t7=AddTriangle(surf,v2,v3,v4) ; top triangle 2 PositionEntity objet,0,-4,10 UpdateNormals objet VertexColor surf, v0, 255,0,0 VertexColor surf, v1, 255,0,0 VertexColor surf, v2, 255,0,0 VertexColor surf, v3, 255,0,0 VertexColor surf, v4, 255,0,0 VertexColor surf, v5, 255,0,0 ;WireFrame True While Not KeyDown(1) TurnEntity objet,0,1,0 RenderWorld Flip Wend |
| ||
You have to tell blitz you want to use vertex colours...EntityFX objet, 2Should do the trick :o) |
| ||
it works. thanks |