

Implementing Hello Triangle with Mantle - mariuz
https://medium.com/@Overv/implementing-hello-triangle-in-mantle-4302450fbcd2

======
xtrumanx
A Black Triangle Moment[0] for Mantle programming?

[0]
[https://web.archive.org/web/20050306071700/http://www.rampan...](https://web.archive.org/web/20050306071700/http://www.rampantgames.com/blog/2004/10/black-
triangle.html)

------
Fiahil
From the article:

> _If you like Rust, you should also check out this project[1], which aims to
> be the first wrapper for Mantle!_

Wow, I surely would like to develop games in rust.

1\. [https://github.com/tomaka/mantle-demo](https://github.com/tomaka/mantle-
demo)

~~~
eddyb
I did find it a bit surprising that Rust is showing up on the scene _that_
fast.

Another interesting project is [https://github.com/gfx-rs/gfx-
rs](https://github.com/gfx-rs/gfx-rs) \- their abstractions may seem too much
for wrapping OpenGL, until you realize they're ready for a Mantle/Vulkan
backend, just need someone to write it.

Personally, I wish I could use Mantle on Linux, but the eventual support is
probably going to skip that stage and go directly for Vulkan.

From reading more online, it seems possible that at least one of Intel, AMD
and Nvidia will release a SteamOS-compatible (and thus, Linux in general)
Vulkan driver later this year.

------
alricb
This has been more helpful than most of the presentations and guides I've seen
so far.

------
phkahler
That's a lot of code. I'm pretty sure I can use SDL to open a window and paint
a triangle with a C-coded rasterizer in few than 500 line.

~~~
alricb
Tons of it is just boilerplate, because Mantle has no default. For instance,
createTargetStates() is a ~50 lines function to set the MSAA, viewport, color
blending, raster and depth stencil states, which mostly have default values in
OpenGL.

The API is relatively straightforward, but you have to do almost _everything_
yourself: you need to put your commands in command buffers, you have to
allocate memory yourself, and you need to create your pipeline and use
descriptor sets to bind your resources (triangles, textures) to it.

So it's not like old-school OpenGL where you could glBegin() and start doing
stuff immediately, but it's only really painful at the start; you'll soon
abstract away most of the boilerplate, and the main hurdle will be to have to
manage your memory and bindings yourself.

I'm sure once Vulkan is released there will soon be libraries that take care
of the boilerplate for you and offer some help to manage memory, bindings and
command buffers.

