self._program[n] = v self._program['tr_scale'] = self._parent.panzoom.scale[:2] self._program['u_dash_atlas'] = gloo.Texture2D(self._collec.da._data) width, height = self.width, self.height self._program['u_scale'] = width//2, height//2 self._program['u_proj'] = orthographic( -width//2, width//2, -height//2, height//2, -1, +1 ) self._program.draw('triangles', indices=self.index) if __name__ == '__main__': ax = PlotCanvas(size=(600,600)) x = np.linspace(-1., 1., 1000) y = .25*np.sin(15*x) vertices1 = np.c_[x,y] vertices2 = np.c_[np.cos(3*x)*.5, np.sin(3*x)*.5] ax.line = LineAggVisual(paths=[vertices1, vertices2], style=[ dict(color=(1., 0., 0., 1.)), dict(color=(0., 1., 0., 1.)), ]) ax.show()
# WARNING/TODO: put the different sets of uniforms and put them in attributes instead for n, v in self._U[0].iteritems(): self._program[n] = v self._program['tr_scale'] = self._parent.panzoom.scale[:2] self._program['u_dash_atlas'] = gloo.Texture2D(self._collec.da._data) width, height = self.width, self.height self._program['u_scale'] = width // 2, height // 2 self._program['u_proj'] = orthographic(-width // 2, width // 2, -height // 2, height // 2, -1, +1) self._program.draw('triangles', indices=self.index) if __name__ == '__main__': ax = PlotCanvas(size=(600, 600)) x = np.linspace(-1., 1., 1000) y = .25 * np.sin(15 * x) vertices1 = np.c_[x, y] vertices2 = np.c_[np.cos(3 * x) * .5, np.sin(3 * x) * .5] ax.line = LineAggVisual(paths=[vertices1, vertices2], style=[ dict(color=(1., 0., 0., 1.)), dict(color=(0., 1., 0., 1.)), ]) ax.show()