code: def create_shader(self, colormap):
      if len(colormap.shape) == 2:
          args = dict(
              n_dims="1",
              tex_t="float",
              texture2D_arg="vec2(v_texcoord, 0.)",
          )
      else:
          args = dict(
              n_dims="2", tex_t="vec2", texture2D_arg="v_texcoord"
          )
      vertex = """
              uniform mat4 projection;
              uniform sampler2D texture;
  
              attribute vec2 position;
              attribute {tex_t} texcoord;
  
              varying {tex_t} v_texcoord;
              void main()
              {{
                  gl_Position = projection * vec4(position, 0.0, 1.0);
                  v_texcoord = texcoord;
              }}
          """.format(
          **args
      )
  
      fragment = """
              uniform sampler2D texture;
              varying {tex_t} v_texcoord;
              void main()
              {{
                  gl_FragColor = texture2D(texture, {texture2D_arg});
              }}
          """.format(
          **args
      )
  
      self.program = gloo.Program(vertex, fragment)
      if len(colormap.shape) == 2:
          self.program["texture"] = np.ascontiguousarray(
              colormap[None, :, :]
          )
      else:
          self.program["texture"] = colormap
      self.program["texture"].interpolation = "linear"
      self.projection = np.eye(4, dtype=np.float32)
  
file_path: vispy/examples/demo/gloo/unstructured_2d.py
imports: import sys
  import numpy
  import scipy.spatial
  from vispy import gloo, app
  from vispy.util.transforms import ortho
label_desc: Use image node_id 2 for calling the Canvas obj's underlying member method code with example usage: obj.create_shader(colormap) without return types