Reputation: 1405
I have a glView which is 51x51px like this.
...
glContext = EAGLContext(API: .OpenGLES2)
glView = GLKView()
glView.context = glContext
ciContext = CIContext(EAGLContext: glContext)
glView.layer.borderColor = UIColor.redColor().CGColor
glView.layer.borderWidth = 3
glView.translatesAutoresizingMaskIntoConstraints = false
widthConstraint = NSLayoutConstraint(item: glView, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 51)
loupeImageView.addConstraint(widthConstraint)
heightConstraint = NSLayoutConstraint(item: glView, attribute: NSLayoutAttribute.Height, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: 51)
loupeImageView.addConstraint(heightConstraint)
...
Later I am drawing the center portion of image
(received from an AVpreviewlayer) into the glView's EAGL-context like this:
ciContext.drawImage(image, inRect: CGRectMake(0, 0, 50, 50),
fromRect: CGRect(x: (image.extent.width/2)-(50/2), y: (image.extent.height / 2)-(50/2), width: source, height: source))
glView.display()
Basically the code works but the exactly same code behaves different on iPad and iPhone5. The results are shown below. The red-borderd rectangle is the glView.
On iPhone the black part (which is the image I am drawing) inside the red rectangle should completely fill the rectangle such as on iPad... not just the bottom left quarter.
Does anybody have an idea what the problem is here ?
Regards Chris
ps.I am on iOS 9.2.1 on both devices
Upvotes: 1
Views: 85