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
|