View Single Post
  #2  
Old 04-18-2014, 09:23 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You can use on-the-fly objects to create the points and lines then add them to a texture quad that is displaying the map. Here is an example:
Code:
import viz
viz.go()

# Points in texture coordinate system
POINTS = [ (0.1,0.2)
		, (0.9,0.2)
		, (0.5,0.8)
]

# Lines in texture coordinate system
LINES = [ [(0.1,0.2), (0.9,0.2)]
		, [(0.1,0.2), (0.5,0.8)]
		, [(0.5,0.8), (0.9,0.2)]
]


# Load map texture
texture = viz.addTexture('ball.jpg')

# Create quad to display texture
quad = viz.addTexQuad(texture=texture, pos=(0,1.5,3))
quad.zoffset(1,1)

# Create points and lines
viz.startLayer(viz.POINTS)
viz.vertexColor(viz.YELLOW)
viz.pointSize(3)
for p in POINTS:
	viz.vertex(p[0]-0.5, p[1]-0.5, 0)

viz.startLayer(viz.LINES)
viz.vertexColor(viz.GREEN)
for l1,l2 in LINES:
	viz.vertex(l1[0]-0.5, l1[1]-0.5, 0)
	viz.vertex(l2[0]-0.5, l2[1]-0.5, 0)

# Add points/lines to quad
viz.endLayer(parent=quad)
Reply With Quote