Graphics programming on macOS using C++ (Code)
Minimum price
Suggested price

Graphics programming on macOS using C++

Part 1: Introduction

About the Book

When people do multi-platform graphics programming on macOS they usually use Vulkan API.

The best resources on learning Vulkan include:

  • The unofficial Sascha Willems tutorial
  • Alexander Overrode unofficial tutorial
  • Khronos documentation

These are absolutely amazing sources of information and I still recommend them to anyone.


Writing a rendering framework is the next step and just like going through the Vulkan API details - might just not be so obvious to everyone. Also, considering small tweaks one has to deal with when starting implementation on macOS.

This brings me to my goal I put myself in front of:

I want to provide an introduction and some examples of steps one needs to take to write a Vulkan rendering framework on macOS in 2023, so that people familiar or unfamiliar with Vulkan or being pros or beginners in C++ could take advantage from.

I decided to put together some information, which otherwise you would need to find by yourself including “How to”s of:

  • Installing necessary software on macOS.
  • Preparing the Environment (Build systems, IDEs, and Window creation frameworks, SDK).
  • Making a simple game that will rely entirely on a single command buffer. To effectively use the CPU offloading features of this API.
  • Some sneak peak of how to build with CMake all official Apple Metal examples (released during WWDC 2022) so you could have a base to learn Metal in future.

Why I decided to write the book ? What value does it bring ?

  • Saves time (configuration, Vulkan specific things in regard to macOS)
  • Small little things that make it possible to start more
  • Share my approach to writing a Vulkan framework

Did I write all of this code by myself ?

  • I used helper functions from Sascha Willems examples and many other official materials from Khronos are MIT licensed code regarding Vulkan.
  • I used the official Apple Metal examples released during WWDC 2022.
  • I used my own rendering framework written on top of Vulkan API.

Is this book for me ?

Targets of this book are:

  • Beginners of graphics development in Vulkan.
  • People moving from Windows and Linux to macOS with their Vulkan projects.
  • People who already went through the unofficial tutorials and want to write actual application.

Advanced users may skip most of the book and go the code directly. Beginners are advices to go through the book first.

About the Author

Filip Wasil
Filip Wasil

I am a C++ graphics programmer from planet Earth with 8 Years of experience in the area.

My projects include:

  • OpenGL trainings
  • OpenGL presentations
  • Open Source 3D graphics renderers (Fillwave, and RearWing)
  • Various internal and public presentations on C++/Graphics related topics on conferences like WroCpp or QT World Summit
  • Vulkan engine development for commercial projects
  • Vulkan demo project in the Automotive area (link)

Table of Contents

    • Introduction
      • Why?
      • Objective-C and Swift
      • Going C++
      • Examples structure
      • Useful shortcuts
    • Package Managers
      • HomeBrew
      • MacPorts
      • Other
    • Build Systems
      • CMake
      • Premake
      • Code
    • Integrated Development Environments
      • Xcode
      • Visual Studio Code
      • Eclipse
      • CLion
      • Qt Creator
      • Other
      • Code
    • Window management libraries
      • SDL2
      • GLFW
      • Generic window
      • Code
    • Graphics APIs
      • OpenGL / OpenGL ES
      • Metal
      • Vulkan and MoltenVK
      • Code
    • Application
      • Entity Component System
      • Minigame
      • Code
    • Summary

Causes Supported

Open Sourcing Mental Illness, Ltd

Changing how we talk about mental health in the tech community.

Changing how we talk about mental health in the tech community.

Open Sourcing Mental Illness is a non-profit, 501c3 corporation dedicated to raising awareness, educating, and providing resources to support mental wellness in the tech and open source communities. OSMI began in 2013 as a speaking campaign by Ed Finkler. Ed started speaking at tech conferences about his personal experiences as a web developer and open source advocate with a mental health disorder. The response was overwhelming, and Ed has continued to speak, gather data, and organize efforts to change experiences of those with mental health disorders in the tech workplace. This includes speaking at conferences and companies, conducting research, and creating documentation to assist companies in making supportive environments for those impacted by mental health disorders. He is assisted in these efforts by selfless volunteers who bring their time and expertise to bear on this important issue.

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub