I’ve created a few simple Win32 apps in previous posts to compare C++ and Rust. Even with unsafe Rust via the windows crate, Win32 API programming feels more accessible to me.

This time, I decided to pivot and add COM objects to our Win32 app. My previous examples were based on GDI, hence adding some Direct3D sounds like a good next step. The issue is that it’s been a while since I last used it, so I chose the familiar Direct3D 9 API. Yes, it’s old, but the windows crate supports it in windows::Win32::Graphics::Direct3D9. The module is manageable, and there are plenty of C++ examples. I found [this tutorial] (http://www.directxtutorial.com/Lesson.aspx?lessonid=9-4-1) and decided to replicate it in Rust.