4 ms·
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 th
by Jare 5y ago
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).
- pjmlp 5y agoMetal and DirectX are based on C++, thankfully.
- my123 5y agoThe 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)
- pjmlp 5y agoThanks for being pedantic, none of them is C.
- vvanders 5y agoPedantically, none of them are C++ either.
- pjmlp 5y agoIn which language are DirectX examples and SDK written on?
- joe91 5y agoWhile 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, ...).
- pjmlp 5y agoBecause COM can be called from C, yet no sane people do it, unless they are trying to make a point no matter what.
- codeflo 5y agoThere’s no shame in simply admitting one was mistaken.
- pjmlp 5y agoI 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.
- tedajax 5y agoI promise you the Vulkan C API is significantly cleaner.
- pjmlp 5y agoBefore 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?