Help with geomTristrips

Can anyone point me to some examples or code that uses GeomTriStrips? Can’t seem to find any practical examples. Trying to port some Java3D code used for rendering 3D hexes. Thanks!

try to look at discourse.panda3d.org/viewtopic.php?t=8507
you could also copy the things from the manual i took most from there.

Hi Khoram,

I put this together for you. You might want to wait until someone that has more experience than I has time to comment on it.

import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from panda3d.core import NodePath
from panda3d.core import GeomTristrips
from panda3d.core import GeomVertexFormat, GeomVertexData
from panda3d.core import GeomNode, Geom
from panda3d.core import GeomVertexWriter


geomformat = GeomVertexFormat.getV3c4( )
vdata = GeomVertexData( 'blank', geomformat, Geom.UHStatic )
vertex = GeomVertexWriter( vdata, 'vertex')
color = GeomVertexWriter( vdata, 'color')
prim = GeomTristrips( Geom.UHStatic ) #hint
geom = Geom(vdata)
geom.addPrimitive(prim)

node = GeomNode('gnode')
node.addGeom(geom)
gpath = NodePath(node)
gpath.reparentTo( render )

vert_and_color= [
	( ( 0,0,0 ), (1,0,0) ),
	( ( 1,0,0 ), (1,0,0) ),
	( ( 0,0,1 ), (1,0,0) ),
	( ( 1,0,1 ), (1,1,0) ),
	( ( 0,0,2 ), (1,0,1) )
]

for vc in vert_and_color:
	vertex.addData3f( *vc[0] )
	color.addData3f( *vc[1] )

prim.addVertices( 0, 1, 2 ) # see manual about C/CW order
prim.addVertex( 3 )
prim.addVertex( 4 )
prim.closePrimitive()

base.cam.setPos( 0, -5, 1 )
run( )

Wow, thank you both, special thanks castironpi for the code! That should get me started, thanks.