   _index_data: () ->
     @_xy_index()
 
-  _map_data: () ->
-    if @_gl?
-        return  # performance
+  _render: (ctx, indices, {sx, sy}) ->
+    drawing = false
+    @visuals.line.set_value(ctx)  # Set before gl, because it uses it too
 
-  _set_data: () ->
-    @_data_changed = true  # notify gl, lazy upload
-
-  _render: (ctx, indices, {sx, sy}) ->
-    
-    @visuals.line.set_value(ctx)  # Set before gl, because it uses it too
-    
-    if ctx.glcanvas
-        if not @_render_gl(ctx, indices)
-          return
-
-    drawing = false
     for i in indices
       if !isFinite(sx[i]+sy[i]) and drawing
         ctx.stroke()

  visuals: ['line']


setup_gl = (gl) ->
  # This function sets up the visualization to render a line

  VERT = """
  precision mediump float;
  attribute float a_x;
  attribute float a_y;
  uniform vec2 u_canvas_size;
  uniform vec2 u_offset;
  uniform vec2 u_scale;
  void main() {
      vec2 pos = vec2(a_x, a_y) * u_scale + u_offset; // in pixels
      pos /= u_canvas_size;  // in 0..1
      gl_Position = vec4(pos*2.0-1.0, 0.0, 1.0);
      gl_Position.y *= -1.0;
  }"""

  FRAG = """
  precision mediump float;
  uniform vec4 u_color;
  void main() {      
      gl_FragColor = u_color;
      gl_FragColor.a = 1.0;
  }"""
    
  prog = new gloo2.Program(gl)
  prog.set_shaders(VERT, FRAG)
  vbo_x = new gloo2.VertexBuffer(gl)
  prog.set_attribute('a_x', 'float', [vbo_x, 0, 0])
  vbo_y = new gloo2.VertexBuffer(gl)
  prog.set_attribute('a_y', 'float', [vbo_y, 0, 0])
  return {'gl': gl, 'prog': prog, 'vbo_x', vbo_x, 'vbo_y': vbo_y}


module.exports =
  Model: Line
  View: LineView

    if drawing
      ctx.stroke()

  _hit_point: (geometry) ->
    ### Check if the point geometry hits this line glyph and return an object
