[[position]] 属性修饰符 vertex:函数修饰符
id<MTLRenderPipelineState> _pipelineState; 渲染管道有点像program
- (void)setVertexBytes:(const void *)bytes length:(NSUInteger)length
atIndex:(NSUInteger)index
不能超过4096字节,超过就要用MTLBuffer
(MTLBuffer)_vertices = [_device newBufferWithBytes:quadVertices
length:sizeof(quadVertices)
options:MTLResourceStorageModeShared];
渲染图片
1.初始化MTKView,设置view.device,分离出render
2.render设置管道,获取 .metal文件,同时获取顶点和片元函数 + 设置顶点缓冲区(MTLBuffer) + 加载纹理(MTLTexture)
3.MTLRenderCommandEncoder 设置顶点,视口,图元等 + 将数据加载到MTLBuffer + 设置纹理对象
网友评论