Hi, I want to show the points as mouse moves, and I program like below:
Code:
def plotGraph(x,y):
viz.startlayer(viz.POINTS)
viz.pointsize(5)
# viz.vertexcolor(viz.RED)
# viz.vertex(0,0,0)
viz.vertexcolor(viz.BLACK)
viz.vertex(x,y,0)
line = viz.endlayer(viz.SCREEN)
print 'plot',x,y
def onMouseMove(e):
plotGraph(e.x,e.y)
viz.go()
viz.clearcolor(viz.SKYBLUE)
viz.callback(viz.MOUSE_MOVE_EVENT,onMouseMove)
The problem is if i comment
Code:
viz.vertexcolor(viz.RED)
viz.vertex(0,0,0)
The code won't work, but if I uncomment them, then it works.
Can anyone tell me why? Is it because startlayer needs at lease two points?
Thank you