def __init__(self): app.Canvas.__init__(self) # Create program self._program = oogl.Program(VERT_SHADER, FRAG_SHADER) # Set uniform and attribute self._program['u_color'] = 0.2, 1.0, 0.4, 1 self._program['a_position'] = oogl.VertexBuffer(vPosition)
def __init__(self): app.Canvas.__init__(self) self.program = oogl.Program(VERT_SHADER, FRAG_SHADER) # Set uniform and attribute self.program['a_color'] = oogl.VertexBuffer(v_color) self.program['a_position'] = oogl.VertexBuffer(v_position) self.program['a_size'] = oogl.VertexBuffer(v_size)
def __init__(self): app.Canvas.__init__(self) self.size = 800, 600 # Create program self._program = oogl.Program(VERT_SHADER, FRAG_SHADER) self._program.set_vars(data.data, s_texture=oogl.Texture2D(im1)) # Create first explosion self._new_explosion()
def __init__(self): app.Canvas.__init__(self) self.size = 560, 420 # Create texture to render to self._rendertex = oogl.Texture2D() # Create FBO, attach the color buffer and depth buffer self._fbo = oogl.FrameBuffer(self._rendertex, oogl.RenderBuffer()) # Create program to render a shape self._program1 = oogl.Program(oogl.VertexShader(VERT_SHADER1), oogl.FragmentShader(FRAG_SHADER1)) self._program1['u_color'] = 0.9, 1.0, 0.4, 1 self._program1['a_position'] = oogl.VertexBuffer(vPosition) # Create program to render FBO result self._program2 = oogl.Program(oogl.VertexShader(VERT_SHADER2), oogl.FragmentShader(FRAG_SHADER2)) self._program2['a_position'] = oogl.VertexBuffer(vPosition) self._program2['a_texcoord'] = oogl.VertexBuffer(vTexcoord) self._program2['u_texture1'] = self._rendertex
def __init__(self): app.Canvas.__init__(self) self.position = (200, 100) self.size = (800, 500) self._program = oogl.Program(VERT_SHADER, FRAG_SHADER) self.dt = 1./1000 self.n = 2000 self._position = np.zeros((self.n, 2)) self._position[:, 1] = .25 * np.random.randn(self.n) prog = self._program prog['a_position'] = oogl.VertexBuffer(self._position) prog['u_translation'] = self.translation prog['u_scale'] = self.scale
def __init__(self): app.Canvas.__init__(self) # Create program self._program = oogl.Program(VERT_SHADER, FRAG_SHADER) # Create vertex buffer self._vbo = oogl.VertexBuffer(vertex_data) # Set uniforms, samplers, attributes # We create one VBO with all vertex data (array of structures) # and create two views from it for the attributes. self._program['texture1'] = oogl.Texture2D(im1) self._program.set_vars(self._vbo) # This does:
def __init__(self, **kwargs): app.Canvas.__init__(self, **kwargs) self.geometry = 0, 0, 400, 400 self.program = oogl.Program(VERT_CODE, FRAG_CODE) # Set attributes self.program['a_position'] = oogl.VertexBuffer(positions) self.program['a_texcoord'] = oogl.VertexBuffer(texcoords) self.program['u_texture'] = oogl.Texture2D(io.crate()) # Handle transformations self.init_transforms() self.timer = app.Timer(1.0 / 60) self.timer.connect(self.update_transforms) self.timer.start()
def __init__(self): app.Canvas.__init__(self) self.size = W*5,H*5 self.program = oogl.Program(VERT_SHADER, FRAG_SHADER) self.texture = oogl.Texture2D(I) self.texture.set_filter(gl.GL_NEAREST, gl.GL_NEAREST) self.program['u_texture'] = self.texture self.program.set_vars(oogl.VertexBuffer(data)) self.view = np.eye(4,dtype=np.float32) self.model = np.eye(4,dtype=np.float32) self.projection = np.eye(4,dtype=np.float32) self.program['u_model'] = self.model self.program['u_view'] = self.view self.projection = ortho(0, W, 0, H, -1, 1) self.program['u_projection'] = self.projection
def __init__(self): app.Canvas.__init__(self) # Time self._t = time.time() self._pos = 0.0, 0.0 self._button = None # Create program self.program = oogl.Program(VERT_SHADER, FRAG_SHADER) # Create vertex buffers self.vbo_position = oogl.VertexBuffer(particles['position']) self.vbo_color = oogl.VertexBuffer(particles['color']) self.vbo_size = oogl.VertexBuffer(particles['size']) # Bind vertex buffers self.program['color'] = self.vbo_color self.program['size'] = self.vbo_size self.program['position'] = self.vbo_position
def __init__(self): app.Canvas.__init__(self) self.size = 800, 600 self.title = "A very fake galaxy [mouse scroll to zoom]" self.program = oogl.Program(VERT_SHADER, FRAG_SHADER) self.view = np.eye(4, dtype=np.float32) self.model = np.eye(4, dtype=np.float32) self.projection = np.eye(4, dtype=np.float32) self.theta, self.phi = 0, 0 self.translate = 5 translate(self.view, 0, 0, -self.translate) self.program.set_vars(data.data, u_colormap=oogl.Texture2D(cmap), u_size=5. / self.translate, u_model=self.model, u_view=self.view) self.timer = app.Timer(1.0 / 60) self.timer.connect(self.on_timer)
def __init__(self): app.Canvas.__init__(self) self.size = 800, 600 self.vertices, self.filled, self.outline = cube() self.program = oogl.Program(vert, frag) self.program.set_vars(oogl.VertexBuffer(self.vertices)) self.view = np.eye(4, dtype=np.float32) self.model = np.eye(4, dtype=np.float32) self.projection = np.eye(4, dtype=np.float32) translate(self.view, 0, 0, -5) self.program['u_model'] = self.model self.program['u_view'] = self.view self.theta = 0 self.phi = 0 self._timer = app.Timer(1.0 / 60) self._timer.connect(self.on_timer) self._timer.start()
def __init__(self): app.Canvas.__init__(self) self.size = 800, 600 self.program = oogl.Program(vert, frag) self.view = np.eye(4, dtype=np.float32) self.model = np.eye(4, dtype=np.float32) self.projection = np.eye(4, dtype=np.float32) self.translate = 5 translate(self.view, 0, 0, -self.translate) self.program.set_vars(data.data, u_linewidth=u_linewidth, u_antialias=u_antialias, u_model=self.model, u_view=self.view, u_size=5 / self.translate) self.theta = 0 self.phi = 0 self.timer = app.Timer(1.0 / 60) self.timer.connect(self.on_timer) self.timer.start()
def __init__(self): app.Canvas.__init__(self) # Create program self._program = oogl.Program( VERT_SHADER, FRAG_SHADER) # Creat FBO self._fbo = oogl.FrameBuffer() self._fbo.attach_depth(oogl.RenderBuffer(im1.shape)) # Create vbo self._vbo = oogl.VertexBuffer(vertex_data) # Create textures self._tex1 = oogl.Texture2D(im1) self._tex2 = oogl.Texture2D(im1.shape) for tex in (self._tex1, self._tex2): tex.set_filter('NEAREST', 'NEAREST') # Set uniforms and attributes self._program.set_vars(self._vbo) self._program['u_texsize'] = im1.shape[1], im1.shape[0]
def __init__(self): app.Canvas.__init__(self) self.program = oogl.Program(VERT_SHADER, FRAG_SHADER) # Set uniform and attribute self.program['a_id'] = oogl.VertexBuffer(a_id) self.program['a_position'] = oogl.VertexBuffer(a_position) self.view = np.eye(4, dtype=np.float32) self.model = np.eye(4, dtype=np.float32) self.projection = np.eye(4, dtype=np.float32) self.translate = 5 translate(self.view, 0, 0, -self.translate) self.program['u_model'] = self.model self.program['u_view'] = self.view self.theta = 0 self.phi = 0 self.timer = app.Timer(1.0 / 60) self.timer.connect(self.on_timer)
def __init__(self, **kwargs): self.program = oogl.Program(VERT_SHADER, FRAG_SHADER) self.view = np.eye(4, dtype=np.float32) self.model = np.eye(4, dtype=np.float32) self.projection = np.eye(4, dtype=np.float32) self.translate = 3 translate(self.view, 0, 0, -self.translate) self.program.set_vars(data.data, u_model=self.model, u_view=self.view, u_size=u_size) self.theta = 0 self.phi = 0 self.index = 0 self.timer = app.Timer(1.0 / 400) self.timer.connect(self.on_timer) self.timer.start() # Initialize for real app.Canvas.__init__(self, **kwargs)