class_docstr: Representation of global shader variable
  
  Parameters
  ----------
  name : str
      the name of the variable. This string can also contain the full
      definition of the variable, e.g. 'uniform vec2 foo'.
  value : {float, int, tuple, GLObject}
      If given, vtype and dtype are determined automatically. If a
      float/int/tuple is given, the variable is a uniform. If a gloo
      object is given that has a glsl_type property, the variable is
      an attribute and
  vtype : {'const', 'uniform', 'attribute', 'varying', 'inout'}
      The type of variable.
  dtype : str
      The data type of the variable, e.g. 'float', 'vec4', 'mat', etc.
class_docstr_tok: ["Representation","of","global","shader","variable","Parameters","--","--","--","--","--","name",":","str","the","name","of","the","variable",".","This","string","can","also","contain","the","full","definition","of","the","variable",",","e.g",".","'uniform","vec2","foo","'",".","value",":","{","float",",","int",",","tuple",",","GLObject","}","If","given",",","vtype","and","dtype","are","determined","automatically",".","If","a","float\/int\/tuple","is","given",",","the","variable","is","a","uniform",".","If","a","gloo","object","is","given","that","has","a","glsl_type","property",",","the","variable","is","an","attribute","and","vtype",":","{","'const","'",",","'uniform","'",",","'attribute","'",",","'varying","'",",","'inout","'","}","The","type","of","variable",".","dtype",":","str","The","data","type","of","the","variable",",","e.g",".","'float","'",",","'vec4","'",",","'mat","'",",","etc","."]
code: def __init__(self, name, value=None, vtype=None, dtype=None):
      super(Variable, self).__init__()
  
      # allow full definition in first argument
      if " " in name:
          fields = name.split(" ")
          if len(fields) == 3:
              vtype, dtype, name = fields
          elif len(fields) == 4 and fields[0] == "const":
              vtype, dtype, name, value = fields
          else:
              raise ValueError(
                  "Variable specifications given by string must"
                  ' be of the form "vtype dtype name" or '
                  '"const dtype name value".'
              )
  
      if not (isinstance(name, str) or name is None):
          raise TypeError("Variable name must be string or None.")
  
      self._state_counter = 0
      self._name = name
      self._vtype = self._vtype_32_conversion.get(vtype, vtype)
      self._dtype = dtype
      self._value = None
  
      # If vtype/dtype were given at init, then we will never
      # try to set these values automatically.
      self._type_locked = (
          self._vtype is not None and self._dtype is not None
      )
  
      if value is not None:
          self.value = value
  
      if self._vtype and self._vtype not in VARIABLE_TYPES:
          raise ValueError("Not a valid vtype: %r" % self._vtype)
  
imports: import numpy
  from .shader_object import ShaderObject
label_desc: Use image node_id 1 to create a new Variable object from inherited base classes: ShaderObject with example: obj = Variable(name, value, vtype, dtype)