CreateMesh/Verices - Urgent Help Needed

Blitz3D Forums/Blitz3D Programming/CreateMesh/Verices - Urgent Help Needed

Rob Pearmain(Posted 2003) [#1]
Hullo,

I am trying out a simple test but cannot get anything to appear.

Below is my code. All I want to do is create a triangle and view it, but the following seems to work, gives no errors, but I cannot see anything ... HELP !

Type vector
	Field	x#
	Field	y#
	Field	z#
End Type

Type lettermesh
	Field mesh%
	Field surface%
end type

Type letter
     field index%
end type

graphics3d 640,480,32,3

cam = createcamera()
mylettermesh.lettermesh = createlettermesh("letters.bmp")

positionentity cam,0,0,-50
pointentity cam,mylettermesh\mesh

makeletter(mylettermesh,0,0,0)

while not keyhit(1)


      updateworld
      renderworld
      flip
wend

clearworld()
endgraphics()

end

function createlettermesh.lettermesh(mytexture$)

	 mytemplettermesh.lettermesh = new lettermesh


	 brush=CreateBrush()
	 dust=LoadTexture(mytexture$,texflag);
 	BrushTexture brush,dust
	BrushFX brush,fx
	BrushBlend brush,1;
	BrushAlpha brush,1;alpha#
	BrushColor brush,255,255,255;r,g,b



	mytemplettermesh\mesh=CreateMesh()


	mytemplettermesh\surface=CreateSurface(mytemplettermesh\mesh,brush)

        FreeBrush brush

	return mytemplettermesh


end function

Function MakeLetter(m.lettermesh,x#,y#,z#)
	a.letter=New letter

	s=m\surface


	i=AddVertex(s,x,y,z ,0.5,-.4)
	  AddVertex(s,x,y,z   ,1.4,1)
	  AddVertex(s,x,y,z   ,-.4,1)
	AddTriangle s,i,i+1,i+2

	a\index=i

End Function




Shambler(Posted 2003) [#2]
You need something like

	i=AddVertex(s,x,y,z ,0.5,-.4)

	  AddVertex(s,x+1,y,z   ,1.4,1)

	  AddVertex(s,x,y-1,z   ,-.4,1)

	AddTriangle s,i,i+1,i+2



since your triangle is a single point otherwise.


Rob Pearmain(Posted 2003) [#3]
lol, excellent, that's fixed it. Thanks so much.