10

I'm an Objective-C / Swift software developer (in training) currently with an application in the App Store. But I have recently really been interested in Metal, Apple's new alternative to OpenGL. But I'm not exactly sure how to begin... Apple's documentation is handy, but only if you really know what you are doing in the first place. Are there any good tips to beginning? I really haven't explored the area of 3D game programming so would you recommend I learn another language first? And if so which?

I'm just looking for good tutorial books or sites that get in depth with the how and why. I like to understand what exactly I'm doing instead of just typing in code, but there are so many languages and beginner's books that I really don't know where to start... Can anyone help me with this?

4

2 回答 2

16

Metal 是一种较新的图形 API。因此,如果您是图形和 3D 游戏编程的新手,您可能希望从 OpenGL 入手——特别是因为有很多教科书教您使用 OpenGL 进行图形的基础知识。至于 OpenGL 上的网页,我最喜欢的网页之一是songho。有关OpenGL ES2.0OpenGL ES3.0的书籍包括使用 OpenGLES for iOS 进行编程的部分。

如果您特别想探索 Metal API 本身,WWDC 2014 上有多个视频详细介绍了基础知识,并演示了如何在 Xcode 中使用 Metal。一篇介绍性文章,详细介绍了objc.io的内容和原因。更详细的一个是metalbyexample

要深入了解这些图形 API 的工作原理,您可能需要掌握 GPU 架构。The Real-Time Rendering可能是这方面最好的书。这些来自加州大学戴维斯分校 John Owens 教授的讲座视频也以清晰简洁的方式描述了该架构。

于 2015-02-05T21:23:15.707 回答
3
  1. 我肯定会推荐Marius Horga 的博客作为起点。我就是这样开始的,Marius 总是愿意提供帮助。

  2. 另一个值得去的地方是Warren Moore 的metalbyexample.com,当然还有他的书。然而,它有大量的代码是用 Objective-C 编写的,但翻译成 Swift 是相当容易的。

  3. 从 Apple 下载示例代码:https ://developer.apple.com/metal/

  4. 最近我创建了一个 GitHub 存储库,如何将 Shadertoy 着色器代码转换为 Metal,您可以在此处访问它。

[重要说明] - 给出的一些示例代码已经与 Xcode 8 和 Swift 3 不兼容,您需要进行必要的更改以防止编译器阻塞它们。如果您需要 Apple 提供的三个出色的代码示例,展示如何使用纹理、CPU 和 GPU 级别的多线程,以及如何在 Metal 中绘制图元,同时兼容 Xcode 8 beta 6、Swift 3,只需给我发一封电子邮件,我会把它们寄给你。

于 2016-08-22T21:50:25.320 回答