0

在我做的时候在macos下:

MTLRenderPassDescriptor* renderPassDesc = [MTLRenderPassDescriptor renderPassDescriptor];

MTLRenderPassColorAttachmentDescriptor* colorAttachmentDesc = [MTLRenderPassColorAttachmentDescriptor new];
colorAttachmentDesc.texture = drawable.texture;
colorAttachmentDesc.loadAction = MTLLoadActionClear;
colorAttachmentDesc.storeAction = MTLStoreActionStore;
colorAttachmentDesc.clearColor = MTLClearColorMake(1, 1, 1, 1);

当我检查我的值后,colorAttachmentDesc.clearColor我可以看到我仍然有 (0, 0, 0, 1) 而不是 (1, 1, 1, 1) !

在 ios 上它工作得很好,但在 macOS 上使用 NSView 而不是 UIView 我不明白为什么它不起作用。我错过了什么?

4

0 回答 0