sub CYL( count as long)
local i as long
local vertexIndex as long
tbgl_m15SetModelVertexCount( 1, count * 12 )
' We will create quads, this sets white color to whole buffer
tbgl_m15SetVertexRGB( 1, 1, count * 12, 128, 128, 128 )
for i = 1 to count
' Lets create base
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, 1, 0, 1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,1)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, 0, 0, 2 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,1)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, -1, 0, 1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,1)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, -1, 0, 1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,1)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, -1, 0, -1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,1)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, 0, 0, -2 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,1)
tbgl_m15SetVertexPStop( 1, vertexIndex, 1 )
' Lets create top
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, 1, 5, 1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,2)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, 0, 5, 2 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,2)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, -1, 5, 1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,2)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, -1, 5, 1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,2)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, -1, 5, -1 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,2)
incr vertexIndex
tbgl_m15SetVertexXYZ( 1, vertexIndex, 0, 5, -2 )
TBGL_M15SETVERTEXLAYER (1,vertexindex,2)
tbgl_m15SetVertexPStop( 1, vertexIndex, 1 )
TBGL_M15RECALCNORMALS 1,1
next
end sub
Does this look like the right sort of code to make a cylinder from .M15setvertexxyz commands
Bookmarks