def _render_buffer(cfg, w, h): n = w * h data = array.array('B', [i * 255 // n for i in range(n)]) buf = ngl.BufferUByte(data=data) texture = ngl.Texture2D(width=w, height=h, data_src=buf) program = ngl.Program(vertex=cfg.get_vert('texture'), fragment=cfg.get_frag('texture')) render = ngl.Render(ngl.Quad(), program) render.update_textures(tex0=texture) return render
def _render_buffer(cfg, w, h): n = w * h data = array.array('B', [i * 255 // n for i in range(n)]) buf = ngl.BufferUByte(data=data) texture = ngl.Texture2D(width=w, height=h, data_src=buf) program = ngl.Program(vertex=cfg.get_vert('texture'), fragment=_RENDER_BUFFER_FRAG) program.update_vert_out_vars(var_tex0_coord=ngl.IOVec2(), var_uvcoord=ngl.IOVec2()) render = ngl.Render(ngl.Quad(), program) render.update_frag_resources(tex0=texture) return render