Apple Metal framework playground
Swift Objective-C Python C++
Failed to load latest commit information.
1. Colored Triangle All samples fixed for iOS8 - beta3 Jul 10, 2014
2. Cube + Transform
3. Texured cube
4. Cube + Lighting All samples fixed for iOS8 - beta3 Jul 10, 2014
5. Imported Model A lot's of refactor done. Jul 4, 2014


After finishing this try-out project I made Flappy bird colne with Metal, go check it out


Task: Create complex 3D scene app using Apples new Metal framework, using Swift as much as possible.

NOTE1: Since I'm trying to use Swift where it's posiible, this code is not super efficient or fast, there are some wrappers which are not recommanded in this kind of projects.

Hope to improve it as new Xcode betas will come out.


1) For now (Xcode 6 - beta2) requires -Ofast compiler flag to build.

2) iOS 8 and device with A7 required! Doesn't work on simulator.

alt tag alt tag alt tag alt tag alt tag

Model importing script

In part 5 i wrote simple python script which parse OBJ file (generated from Blender or any other 3D model tool) and produce Swift class and txt file.

Here are steps on how I used it to get that Ram rendered. Here's a link to free 3D model, thanks to dipsy.

  1. Put your OBJ and MTL file (generated from Blender) into one folder alt tag

  2. Make sure that both OBJ and MTL files have same name, and this name will be your Swift class name, in my case it's "ram.obj" and "ram.mtl"

  3. Put file into same folder alt tag

  4. From terminal cd to your folder alt tag

  5. Run following command "python name" name should be equal to .obj and .mtl file names in my case it's "ram" alt tag

  6. Check you folder, .swift and .txt files should be there, drag and drop them into your project alt tag alt tag

  7. Double check .swift file, wethere texture name is correct alt tag

  8. Use imported model as any other Model subclass inside your MetalViewController