                                    AVCaptureVideoDataOutputSampleBufferDelegate {
   public func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputSampleBuffer sampleBuffer: CMSampleBuffer!, from connection: AVCaptureConnection!) {
     // to be implemented
-    print("capture", captureOutput)
+    if captureOutput is AVCaptureVideoDataOutput {
+      //print("capture", captureOutput)
+      render()
+    } else {
+      print("capture", captureOutput)
+    }
   }
 }
 

  let vertexData:[Float] = [ 0.0, 1.0, 0.0, -1.0, -1.0, 0.0, 1.0, -1.0, 0.0 ]
  var pipelineState: MTLRenderPipelineState?
  var commandQueue: MTLCommandQueue?
  var timer: CADisplayLink?

  override func viewDidLoad() {
    super.viewDidLoad()

    
    commandBuffer.present(drawable)
    commandBuffer.commit()
    print("render")
  }
  
  override func viewDidLayoutSubviews() {
