Hi,
I am very new to Panda (as in I started yesterday). I am creating a video player and so am using the sample which uses a VideoTexture, problem is, I want more than one video playing (I know this is meant to have bad performance but I’ll work on that later).
I’ve hit a fundamental problem as I don’t know how panda3d really does texturing on primitives. I’ve got as far as creating 6 vertices with texcoords and put them into a GeomVertexData, then tried to create 2 tristrips from these 6 points to get 4 triangles (2 quads) as follows:
o–o--o
|\ |\ |
| | |
o–o--o
(o = vertex, \ = triangle edge)
I have added the first quad (as a tristrip) to a Geom, then that into a GeomNode then that into a NodePath as described in the documentation:
prim1 = GeomTristrips(Geom.UHStatic)
prim1.addVertices(0, 1, 2, 3)
geom1 = Geom(vdata)
geom1.addPrimitive(prim1)
node1 = GeomNode('gnode1')
node1.addGeom(geom1)
self.nodePath1 = render.attachNewNode(node1)
self.nodePath1.setTexture(self.tex1)
self.nodePath1.setTexScale(TextureStage.getDefault(), self.tex1.getTexScale())
(ignore the indentation messups).
This is where my problem lies. The texcoords are set up correct for the first tristrip but that means the 2nd one will be messed up right? Because they share those 2 middle vertices?
So should I just use 8 vertices, duplicating the middle 2 to be able to set up the texcoords correctly or is the optimisation of sharing vertices worth it?
Also, I have a problem understanding how textures get applied, can I not just bind a texture to certain vertices like with raw OpenGL? Do I have to play a texture to a NodePath, and if so, does that mean I can only have one of my tristrips in a NodePath (as I have 2 videos playing, one for each quad)?
It would be very nice if I could create one NodePath or something that has 2 textures on it for both tristrips because otherwise the code looks a bit bloated and there are lots of duplicates.
Thanks for your time,
Poncho