View Single Post
  #1  
Old 01-28-2011, 06:59 AM
jincheker jincheker is offline
Member
 
Join Date: Oct 2009
Posts: 15
Why I need two points for viz.startlayer(viz.POINTS)

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
Reply With Quote