Drawing a Triangle (Finally)

By Kshitij Aucharmal3 minutes read

“Yup, all I can show after 2 weeks is this triangle.”
— Me, after losing sleep to a graphics API


Triangle Image

If you’ve ever written a graphics engine — or even touched a graphics API — you know that getting a triangle on screen is no joke.

But after 2 weeks of wrestling Vulkan into submission, I finally did it. And this triangle? It’s beautiful. Not because it’s a work of art, but because it represents the first real pixel in my AI-powered simulation engine: ConceptForge.


The Vulkan Struggle Is Real

I followed the Khronos Vulkan Tutorial to get started.

Okay fine — partially followed. I may have… copy-pasted a few things without fully understanding them. 🙈 But hey — when you’re dealing with hundreds of lines of boilerplate just to clear the screen, you do what you gotta do.

Vulkan is not like OpenGL. It doesn’t hold your hand.
It doesn’t even look at you. It just gives you raw power, and expects you to wire up everything — memory management, pipelines, synchronization, shaders, framebuffers, render passes… all of it.

But it does so explicitly, and that’s kind of the genius of it.


Structs, Not Functions

Most things in Vulkan are set up by creating structs, filling them out, and passing them into Vulkan functions.

For example, creating a framebuffer looks like this:

VkFramebufferCreateInfo framebufferInfo{};
framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
framebufferInfo.renderPass = renderPass;
framebufferInfo.width = swapChainExtent.width;
framebufferInfo.height = swapChainExtent.height;
framebufferInfo.layers = 1;

if (vkCreateFramebuffer(device, &framebufferInfo, nullptr, &swapChainFramebuffers[i]) != VK_SUCCESS) {
    throw std::runtime_error("failed to create framebuffer!");
}

Notice how there’s:

I actually like this model. It avoids long, confusing function calls with 10+ parameters, and makes the code pretty readable — especially once you understand what the structs do.


It’s Just a Triangle… or Is It?

Sure, visually it’s just three vertices forming a triangle.

But behind the scenes?

If that sounds like overkill for a triangle… that’s because it is.
But it’s also the groundwork for everything that will follow.


The Next Step

Now that I’ve got a triangle on screen, I need a break from Vulkan boilerplate.
So, I’m going to integrate Dear ImGui next — to add a nice GUI overlay and make debugging and interaction a lot easier moving forward.

Being able to click buttons, inspect data, and tweak values in real-time is going to be a game changer as I start building out the actual engine systems.


This isn’t just about rendering a triangle.
It’s about building the foundation for ConceptForge — my AI-powered simulation engine where users will eventually just describe a world in plain English… and watch it unfold.

Today, it’s a triangle.
Tomorrow, it’ll be a procedurally generated city full of AI agents reacting to gravity and laser beams.

Stay tuned 🚀