Beispiel #1
0
	def augment_mouse_event(self, event):
		Widget.augment_mouse_event(self, event)
		w, h = self.size
		viewport = (0, 0, w, h)
		self.setup_matrices()
		gf = GL.glGetFloatv
		pr_mat = gf(GL.GL_PROJECTION_MATRIX)
		mv_mat = gf(GL.GL_MODELVIEW_MATRIX)
		x, y = event.local
		y = h - y
		up = GLU.gluUnProject
		p0 = up(x, y, 0.0, mv_mat, pr_mat, viewport)
		p1 = up(x, y, 1.0, mv_mat, pr_mat, viewport)
		event.dict['ray'] = (p0, p1)
Beispiel #2
0
 def augment_mouse_event(self, event):
     Widget.augment_mouse_event(self, event)
     w, h = self.size
     viewport = (0, 0, w, h)
     self.setup_matrices()
     gf = GL.glGetFloatv
     pr_mat = gf(GL.GL_PROJECTION_MATRIX)
     mv_mat = gf(GL.GL_MODELVIEW_MATRIX)
     x, y = event.local
     y = h - y
     up = GLU.gluUnProject
     p0 = up(x, y, 0.0, mv_mat, pr_mat, viewport)
     p1 = up(x, y, 1.0, mv_mat, pr_mat, viewport)
     event.dict['ray'] = (p0, p1)
Beispiel #3
0
 def augment_mouse_event(self, event):
     Widget.augment_mouse_event(self, event)
     w, h = self.size
     viewport = numpy.array((0, 0, w, h), dtype='int32')
     self.setup_matrices()
     gf = GL.glGetDoublev
     pr_mat = gf(GL.GL_PROJECTION_MATRIX)
     mv_mat = gf(GL.GL_MODELVIEW_MATRIX)
     x, y = event.local
     y = h - y
     up = GLU.gluUnProject
     try:
         p0 = up(x, y, 0.0, mv_mat, pr_mat, viewport)
         p1 = up(x, y, 1.0, mv_mat, pr_mat, viewport)
         event.dict['ray'] = (p0, p1)
     except ValueError: #projection failed!
         pass
Beispiel #4
0
 def augment_mouse_event(self, event):
     Widget.augment_mouse_event(self, event)
     w, h = self.size
     viewport = numpy.array((0, 0, w, h), dtype='int32')
     self.setup_matrices()
     gf = GL.glGetDoublev
     pr_mat = gf(GL.GL_PROJECTION_MATRIX)
     mv_mat = gf(GL.GL_MODELVIEW_MATRIX)
     x, y = event.local
     y = h - y
     up = GLU.gluUnProject
     try:
         p0 = up(x, y, 0.0, mv_mat, pr_mat, viewport)
         p1 = up(x, y, 1.0, mv_mat, pr_mat, viewport)
         event.dict['ray'] = (p0, p1)
     except ValueError:  # projection failed!
         pass