在OpenGLES中,裁剪和裁剪很简单。通过使用直通着色器缩放像素缓冲区,然后设置
glViewport(0, 0, srcDimensions.width, srcDimensions.height)
然后设置纹理&顶点坐标使用cropRect,然后设置
进行适当的坐标 glActiveTexture( GLenum(GL_TEXTURE0) )
glBindTexture( CVOpenGLESTextureGetTarget( dstTexture! ), CVOpenGLESTextureGetName( dstTexture! ) )
glTexParameteri( GLenum(GL_TEXTURE_2D), GLenum(GL_TEXTURE_MIN_FILTER), GL_LINEAR )
glTexParameteri( GLenum(GL_TEXTURE_2D), GLenum(GL_TEXTURE_MAG_FILTER), GL_LINEAR )
glTexParameteri( GLenum(GL_TEXTURE_2D), GLenum(GL_TEXTURE_WRAP_S), GL_CLAMP_TO_EDGE )
glTexParameteri( GLenum(GL_TEXTURE_2D), GLenum(GL_TEXTURE_WRAP_T), GL_CLAMP_TO_EDGE )
glFramebufferTexture2D( GLenum(GL_FRAMEBUFFER), GLenum(GL_COLOR_ATTACHMENT0), CVOpenGLESTextureGetTarget( dstTexture! ), CVOpenGLESTextureGetName( dstTexture! ), 0 )
Metal中同样的东西的等效设置是什么?