Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C can interop with anything.

There are higher level graphics libraries on top of OpenGL, Vulkan, Metal, WebGL & DirectX, for example bgfx or sokol, but IIRC they still go C style for the same reason. Then there are language-specific libraries that will be idiomatic, like wgpu for Rust. Finally, you reach entire very opinionated game engines at various levels (Unity, UE, Godot, etc).



Metal and DirectX are based on C++, thankfully.


The exposed API for Metal is Obj-C, and the one for DirectX is using COM.

(for shaders, MSL is a C++ dialect, but HLSL isn't)


Thanks for being pedantic, none of them is C.


Pedantically, none of them are C++ either.


In which language are DirectX examples and SDK written on?


While not being based on C DirectX actually has a C API, even for D3D12. For example to call device->CreateRootSignature(...) from C you call ID3D12Device_CreateRootSignature(device, ...).


Because COM can be called from C, yet no sane people do it, unless they are trying to make a point no matter what.


There’s no shame in simply admitting one was mistaken.


I am not mistaken.

DirectX is a COM API, and although some masochits can make use of it from C, 99% of the world does not, including the official SDK.

Metal is a mix of Objective-C and C++, with Swift bindings thanks Objective-C interop.

None of them are C based like Khronos darlings.


I promise you the Vulkan C API is significantly cleaner.


Before or after dealing with the dynamic loading of all required extensions, validation layers, memory allocator (which AMD had to create a more user friendly wrapper) and initialization boilerplater?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: