trouble creating meshes from scratch in B3d

Blitz3D Forums/Blitz3D Programming/trouble creating meshes from scratch in B3d

Well, got it working. Dunno if it's the right way to do it. You need to set the U V clamps for the vertex, and also each side needs its own 4 vertexes(I was reusing the ones thet are in the same pos, but this mucks up the texture)

Here is the code for those interested (Only 3 sides of the cube are done)
Graphics3D 640,480
SetBuffer BackBuffer()

mesh = CreateMesh()
surf = CreateSurface(mesh)


;front
v00=AddVertex(surf,-3,-3,-3,  0,1);BL
v01=AddVertex(surf, 3,-3,-3,  1,1);BR
v02=AddVertex(surf,-3, 3,-3,  0,0);TL
v03=AddVertex(surf, 3, 3,-3,  1,0);TR

;leftside
v06=AddVertex(surf,-3,-3,-3,  1,1);BR
v07=AddVertex(surf,-3, 3,-3,  1,0);TR

v04=AddVertex(surf,-3,-3, 3,  0,1);BL
v05=AddVertex(surf,-3, 3, 3,  0,0);TL

;back
v08=AddVertex(surf,-3,-3, 3,  1,1);BR
v09=AddVertex(surf,-3, 3, 3,  1,0);TR

v10=AddVertex(surf, 3,-3, 3,  0,1);Bl
v11=AddVertex(surf, 3, 3, 3,  0,0);Tl





tri=AddTriangle(surf,v00,v02,v01);down
tri=AddTriangle(surf,v02,v03,v01);up

tri=AddTriangle(surf,v04,v05,v06)
tri=AddTriangle(surf,v05,v07,v06)

tri=AddTriangle(surf,v10,v11,v08)
tri=AddTriangle(surf,v11,v09,v08)


tex=LoadTexture("oldbric.bmp",1)
EntityTexture mesh,tex

cam = CreateCamera()
MoveEntity cam, 0,0,-10

UpdateNormals mesh

While Not KeyDown( 1 ) 
If KeyDown(19) Then TurnEntity mesh,0,1,0
RenderWorld 
;Text 0,0,TrisRendered()
Flip 
Wend 


End