I have been using some OpenGL code for my objective-c camera capture session, which I barely understand. Now OpenGL is depreciated, and I have no idea how to convert this little bit of OpenGL code to metal. If anyone knows both enough to convert the below please help.
if (self.eaglContext != [EAGLContext currentContext]) {
[EAGLContext setCurrentContext:self.eaglContext];
}
glClearColor(0.5, 0.5, 0.5, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
there is a little more OpenGL I didn't see:
_eaglContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
_videoPreviewView = [[GLKView alloc] initWithFrame:self.view.bounds context:_eaglContext];
_videoPreviewView.enableSetNeedsDisplay = NO;
_videoPreviewView.transform = CGAffineTransformMakeRotation(M_PI_2);
_videoPreviewView.frame = self.view.bounds;
[self.view addSubview:_videoPreviewView];
[self.view sendSubviewToBack:_videoPreviewView];
[_videoPreviewView bindDrawable];
_videoPreviewViewBounds = CGRectZero;
_videoPreviewViewBounds.size.width = _videoPreviewView.drawableWidth;
_videoPreviewViewBounds.size.height = _videoPreviewView.drawableHeight;
_ciContext = [CIContext contextWithEAGLContext:_eaglContext options:@{kCIContextWorkingColorSpace : [NSNull null]} ];