5
3
2
u/Both_Possibility_210 Aug 17 '22 edited Aug 17 '22
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.
3
u/guruprasadah Aug 17 '22
Thanks for your advice, but I'm looking to master the basics of graphics until I move up to the big boys.
31
u/Hedanito Aug 14 '22 edited Aug 15 '22
The first triangle is always the hardest, congratz!
Edit: Hardest, not harvest 😅
12
17
u/nnevatie Aug 14 '22
Gratz! After the first triangle, everything is possible, your imagination being the limit.
8
u/SamyBencherif Aug 14 '22
This screenshot is so beautiful. Also didn't realize nvim had all these TUI features ? using plug ins ?
7
4
u/Eindacor_DS Aug 14 '22
I legit still remember where I was when I got my first hello triangle app working, which was 10 or so years ago
1
u/Bananaft Aug 15 '22
May I ask for your nvim config, good sir?
2
u/guruprasadah Aug 15 '22 edited Aug 15 '22
Give me a few hours, will get it on g'hub
EDIT: Here is is: configs
1
u/Attorney-Outside Aug 15 '22
also learn about vertex buffet objects next
1
u/guruprasadah Aug 16 '22
Umm.. That's how I got it to the screen... Using a vbo and ebo.
1
u/Attorney-Outside Aug 16 '22
oh ok nice, I saw your vector of vertices and didn't know how you were feeding them to opengl, good job
1
8
u/314kabinet Aug 14 '22
Congrats! But for god’s sake, use const.
0
Aug 14 '22
[deleted]
5
u/314kabinet Aug 14 '22
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.
8
u/fgennari Aug 14 '22
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.
1
u/MausGames Aug 15 '22
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.
3
1
1
15
u/sadistic_tunche Aug 14 '22
Nice, is it opengl or vulkan?