View Single Post
  #3  
Old 01-11-2005, 03:55 PM
Johannes Johannes is offline
Member
 
Join Date: Jan 2005
Posts: 143
Yes, good and easy idea, that's what I want to do but your approach does not seem to work with this code. (Code below works but if I change the line to points = viz.endlayer(viz.SCREEN) it does not work right. The screen does not seem to actualize itself on runtime?!


Code:
import viz

viz.go()


RADIUS=1

viz.startlayer(viz.LINE_LOOP)
viz.vertexcolor(2, 4, 4)
viz.vertex(-RADIUS, -RADIUS, RADIUS)
viz.vertex(-RADIUS,  RADIUS, RADIUS)
line = viz.endlayer()

viz.startlayer(viz.LINE_LOOP)
viz.vertexcolor(2, 4, 4)
viz.vertex(-RADIUS, -RADIUS, RADIUS)
viz.vertex(RADIUS,  -RADIUS, RADIUS) 
line2 = viz.endlayer()
#line.translate(3,2,4)

SPIsSet,EPIsSet=0,0
startPoint=[0,0,0]
endPoint=[0,0,0]
show=1
pointListe=[]

def mousedown(button):
	# 
	if button == viz.MOUSEBUTTON_LEFT:
		global startPoint,SPIsSet
		global endPoint,EPIsSet, pointListe
		if SPIsSet==0:
			startPoint=viz.screentoworld(viz.mousepos())
			#print 'startPoint:',startPoint
			#SPIsSet=1
			pointListe.append(startPoint)
			drawPoints()
		else:
			print 'forgot option 3'
	if button == viz.MOUSEBUTTON_RIGHT:
		show=1
		drawPoints()
			
def drawPoints():
	viz.startlayer(viz.POINTS)
	viz.vertexcolor(0,12,1)
	viz.pointsize(2)
	for object in pointListe:
		print 'pointliste',pointListe
		viz.vertex(object)
	points = viz.endlayer()



	
#Create callbacks for timer events and mouse click events
viz.callback(viz.MOUSEDOWN_EVENT,mousedown)
Reply With Quote