MCPcopy Create free account
hub / github.com/Image-Py/imagepy / on_ctx

Method on_ctx

imagepy/core/myvi/manager.py:67–77  ·  view source on GitHub ↗
(self, ctx, prog)

Source from the content-addressed store, hash-verified

65 self.width = 1
66
67 def on_ctx(self, ctx, prog):
68 self.ctx = ctx
69 vts, ids, ns, cs = self.vts, self.ids, self.ns, self.cs;
70 buf = self.buf = np.zeros((len(vts), 9), dtype=np.float32)
71 buf[:,0:3], buf[:,3:6], buf[:,6:9] = vts, ns, cs
72 self.vbo = ctx.buffer(buf.tobytes())
73 ibo = ctx.buffer(ids.tobytes())
74
75 content = [(self.vbo, '3f 3f 3f', 'v_vert', 'v_norm', 'v_color')]
76 self.vao = ctx.vertex_array(prog, content, ibo)
77 self.prog = prog
78
79 def set_style(self, mode=None, blend=None, color=None, visible=None):
80 if not mode is None: self.mode = mode

Callers 3

add_surfMethod · 0.95
on_ctxMethod · 0.45
InitGLMethod · 0.45

Calls 1

bufferMethod · 0.80

Tested by

no test coverage detected