def enable(z = nil)
      $window.gl z do
        raise ShaderError, "This shader already enabled." if enabled?
        current_shader = Gl.glGetIntegerv GL::GL_CURRENT_PROGRAM
        raise ShaderError, "Another shader already enabled." if current_shader > 0

        @previous_program = current_shader
        Gl.glUseProgram @program
      end

      result = nil

      if block_given?
        begin
          result = yield self
        ensure
          disable z
        end
      end

      result
    end
def enable(z = nil)
      $window.gl z do
        raise ShaderError, "This shader already enabled." if enabled?
        current_shader = Gl.glGetIntegerv GL::GL_CURRENT_PROGRAM
        raise ShaderError, "Another shader already enabled." if current_shader > 0

        @previous_program = current_shader
        Gl.glUseProgram @program
      end

      result = nil

      if block_given?
        begin
          result = yield self
        ensure
          disable z
        end
      end

      result
    end
Make this the current shader program. Use with a block or, alternatively, use #enable and #disable separately.