在 OpenGLES 中,通过使用 pass through shaders 来裁剪和缩放像素缓冲区很简单,然后设置
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中相同事物的等效设置是什么?