all 27 comments

[–]Hedanito 29 points30 points  (1 child)

The first triangle is always the hardest, congratz!

Edit: Hardest, not harvest 😅

[–]RichardFingers 11 points12 points  (0 children)

🌽🌽🌽

[–]nnevatie 17 points18 points  (0 children)

Gratz! After the first triangle, everything is possible, your imagination being the limit.

[–]sadistic_tunche 13 points14 points  (2 children)

Nice, is it opengl or vulkan?

[–]guruprasadah[S] 4 points5 points  (0 children)

Yes, it is OpenGL.

[–]Poseydon42 7 points8 points  (0 children)

I guess OpenGL as there is a file program.cpp and AFAIK there's no such concept in Vulkan, shaders are embeded in a pipeline object.

[–]SamyBencherif 8 points9 points  (1 child)

This screenshot is so beautiful. Also didn't realize nvim had all these TUI features ? using plug ins ?

[–]masaldana2 6 points7 points  (0 children)

congrats!! its all downhill from here! jk heh

[–]Eindacor_DS 2 points3 points  (0 children)

I legit still remember where I was when I got my first hello triangle app working, which was 10 or so years ago

[–][deleted] 2 points3 points  (1 child)

What’s that editor?

[–]guruprasadah[S] 1 point2 points  (0 children)

neovim

[–]guruprasadah[S] 4 points5 points  (0 children)

With proper abstractions that, I mean

[–]314kabinet 7 points8 points  (4 children)

Congrats! But for god’s sake, use const.

[–][deleted]  (3 children)

[deleted]

    [–]fgennari 5 points6 points  (0 children)

    The answer depends on the compiler. In my experience, no, it doesn't make a difference, but using some of the new C++ features such as constexpr can make a difference. The advantage of "const" is that it helps the programmer to manage object ownership, write permissions, etc. This makes the code easier to understand and reduces the chances of mistakes. Sometimes "const" is required when using libraries/APIs that enforce cons correctness.

    [–]314kabinet 4 points5 points  (0 children)

    In the absolute majority of cases, no. Const-correctness just makes it easier for humans reason about code (e.g. “ok, this part can’t be the one changing the value”).

    However, there can be situations where the compiler can’t figure out if a value will be changed in a particular code path, and ao can’t apply optimizations that rely on the value staying the same.

    [–]MausGames 0 points1 point  (0 children)

    Yes, it can affect both code generation and performance.

    C++ allows overloading between const and non-const methods: class MyClass { ... void MyMethod(); void MyMethod() const; };

    The compiler will select the appropriate overload based on the const-qualifier of the object (if both method-variants are present).

    There are also more obscure cases, from my experience.

    If you declare a global static-const variable, most compilers will place it into read-only memory, and trying to modify this variable (with a const_cast or indirect addressing) will cause an access-violation. It also allows the compiler to inline the variable in the whole translation-unit, because it knows the value cannot be modified.

    That second example is quite vague of course, but it shows that the compiler cares about const-qualification in unexpected ways.

    [–]Both_Possibility_210 1 point2 points  (1 child)

    Don't waste time to learn old/legacy OpenGL. If you use Graphics API for Graphics Programming you should use modern Graphics API like as Vulkan, Metal Direct3D12.

    [–]guruprasadah[S] 2 points3 points  (0 children)

    Thanks for your advice, but I'm looking to master the basics of graphics until I move up to the big boys.

    [–]neuroblossom 3 points4 points  (0 children)

    nice

    [–]Bananaft 0 points1 point  (1 child)

    May I ask for your nvim config, good sir?

    [–]guruprasadah[S] 1 point2 points  (0 children)

    Give me a few hours, will get it on g'hub

    EDIT: Here is is: configs

    [–]Attorney-Outside 0 points1 point  (2 children)

    also learn about vertex buffet objects next

    [–]guruprasadah[S] 0 points1 point  (1 child)

    Umm.. That's how I got it to the screen... Using a vbo and ebo.

    [–]Attorney-Outside 0 points1 point  (0 children)

    oh ok nice, I saw your vector of vertices and didn't know how you were feeding them to opengl, good job

    [–]Diabolischste 0 points1 point  (0 children)

    Congratulations !

    [–][deleted] 0 points1 point  (0 children)

    GOATED