Example #1
0
  init() {

    const { gl } = this;
    const frag = this.FRAG.replace(/MARKERCODE/, this.MARKERCODE);

    this.last_trans = {};  // Keep track of transform

    // The program
    this.prog = new Program(gl);
    this.prog.set_shaders(this.VERT, frag);
    // Real attributes
    this.vbo_x = new VertexBuffer(gl);
    this.prog.set_attribute('a_x', 'float', this.vbo_x);
    this.vbo_y = new VertexBuffer(gl);
    this.prog.set_attribute('a_y', 'float', this.vbo_y);
    this.vbo_s = new VertexBuffer(gl);
    this.prog.set_attribute('a_size', 'float', this.vbo_s);
    this.vbo_a = new VertexBuffer(gl);
    this.prog.set_attribute('a_angle', 'float', this.vbo_a);
    // VBO's for attributes (they may not be used if value is singleton)
    this.vbo_linewidth = new VertexBuffer(gl);
    this.vbo_fg_color = new VertexBuffer(gl);
    this.vbo_bg_color = new VertexBuffer(gl);
    return this.index_buffer = new IndexBuffer(gl);
  }
Example #2
0
    init(): void {
      const {gl} = this;
      this._scale_aspect = 0;  // keep track, so we know when we need to update segment data

      // The program
      this.prog = new Program(gl);
      this.prog.set_shaders(this.VERT, this.FRAG);
      this.index_buffer = new IndexBuffer(gl);
      // Buffers
      this.vbo_position = new VertexBuffer(gl);
      this.vbo_tangents = new VertexBuffer(gl);
      this.vbo_segment = new VertexBuffer(gl);
      this.vbo_angles = new VertexBuffer(gl);
      this.vbo_texcoord = new VertexBuffer(gl);
      // Dash atlas
      this.dash_atlas = new DashAtlas(gl);
    }
Example #3
0
  protected init(): void {
    const {gl} = this

    const vert = vertex_shader
    const frag = fragment_shader(this._marker_code)

    // The program
    this.prog = new Program(gl)
    this.prog.set_shaders(vert, frag)
    // Real attributes
    this.vbo_x = new VertexBuffer(gl)
    this.prog.set_attribute('a_x', 'float', this.vbo_x)
    this.vbo_y = new VertexBuffer(gl)
    this.prog.set_attribute('a_y', 'float', this.vbo_y)
    this.vbo_s = new VertexBuffer(gl)
    this.prog.set_attribute('a_size', 'float', this.vbo_s)
    this.vbo_a = new VertexBuffer(gl)
    this.prog.set_attribute('a_angle', 'float', this.vbo_a)
    // VBO's for attributes (they may not be used if value is singleton)
    this.vbo_linewidth = new VertexBuffer(gl)
    this.vbo_fg_color = new VertexBuffer(gl)
    this.vbo_bg_color = new VertexBuffer(gl)
    this.index_buffer = new IndexBuffer(gl)
  }