title: How to convert UIView drawing to GLKView on swift?
body: <p>I need to convert the drawing image code in UIView to the code in GLKView.</p>
  
  <p>I had implemented 2D avatar player with 30fps in UIView. But the app is very slow and the animation is not smooth. I received a suggestion that convert it to openGL. But I have no experience with openGL. I already changed the custom UIView to GKLView. The issue is just how to convert  transform of CGContext to transform of CIContext.</p>
  
  <p>// context : CGContext</p>
  
  <pre><code>var transForm = CGAffineTransform.identity
  transForm = transForm.translatedBy(x: CGFloat(dx * scale), y: CGFloat(dy * scale))
  transForm = transForm.scaledBy(x: CGFloat(scale), y: CGFloat(scale))
  transForm = transForm.rotated(by: CGFloat(-dang ))
  transForm = transForm.scaledBy(x: CGFloat(scaleX), y: CGFloat(scaleY))
  transForm = transForm.translatedBy(x: CGFloat(-ox + vdw / 2), y: CGFloat(-oy + vdh / 2))
  transForm = transForm.scaledBy(x: CGFloat(fh), y: CGFloat(-fv))
  context.concatenate(transForm)
  let src:CGRect = CGRect(x: CGFloat(sx), y: CGFloat(sy), width: CGFloat(sw), height: CGFloat(sh))
  let dest:CGRect = CGRect(x: CGFloat(-vdw/2), y: CGFloat(-vdh/2), width: CGFloat(vdw), height: CGFloat(vdh))
  let cropedImage:CGImage! = img.cropping(to: src)
  context.draw(cropedImage, in: dest, byTiling: false);
  </code></pre>