The programming thread.

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
For the moment I will be using QT Creator, since I am using Qt. I may switch to VS Code later. If I feel like it. I'm doing this strictly for fun, so I'll end up using the tools I like best (not necessarily the best tool). I liked VS Code last time I used it.

BTW, I switched to Vulkan, mainly because the tutorials I consulted for openGL did a fairly lousy job explaining how to set up the environment. They explained some of the settings needed, but not everything. So I had to google to find the things that were lacking.

The Vulkan Tutorial I found (https://vulkan-tutorial.com/Introduction) did this part very well. So Vulkan it is.

pibbuR who …. whatever.

PS. For learning Vulkan I use VS 2017 (and C++17), because that's the IDE used for windows in the tutorial. DS.
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Myrthos

Cave Canem
Joined
Aug 30, 2006
Messages
11,212
So it's a good tool, but for a complete set of features it's so much easier with an IDE made for that purpose. I'm only outlining the respective advantages.
I read that IntelliJ has over 3000 plugins :)
 
Joined
Aug 30, 2006
Messages
11,212

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,761
Location
Good old Europe
I read that IntelliJ has over 3000 plugins :)

Hehe, oops, that's right.

But the necessary ones are pre-installed, for example the language themselves. Then there are optional plugins from JetBrains too, that you can opt out of when installing. I usually take the default set with Git, GitHub, Gradle, Maven, Android, Spring, Database SQL support & connectors, JS, HTML, ... because it's quickly installed anyway and I often need several of them.

Sure, there are many 3rd-party free and paying plugins for a lot of things, but I rarely need any of them. It's the same type of ecosystem as Visual Studio.

Bottom line, I only had to add one for Rust, and a 3rd-party one to generate a compiler front-end from the grammar (ANTLR), they're not really usual requirements.

But if I want to do C# or C++, it's not supported. :)
 
Joined
Aug 29, 2020
Messages
5,761
Location
Good old Europe

Ripper

Зичу Вам успіхів
Joined
Nov 8, 2014
Messages
11,683
Joined
Nov 8, 2014
Messages
11,683

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,761
Location
Good old Europe
I suppose we all have our own way to hone our skills.

Doom must be the most hacked game, in every way. That's how we first got map editors, it must have been hard to figure out the structure with 3D tricks like BSP. Or maybe id had published a paper on that?

Later they published the Game Engine Black Book: Doom which I think explains much about how the game is made.
 
Joined
Aug 29, 2020
Messages
5,761
Location
Good old Europe

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
So I've started learning Vulkan, following this excellent tutorial: https://vulkan-tutorial.com/Introduction.

Following the Drawing A Triangle chapter, this is the result:
triangle.png

Now, Vulkan is a low level Graphics API, which means that it's very verbose compared to OpenGl and Direct 3D. They like loooong typenames (VkPipelineMultisampleStateCreateInfo), function names (vkGetPhysicalDeviceQueueFamilyProperties()) and macro names (VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO). In addition, what require a few instructions in openGl, takes significantly more in Vulkan. The good thing is that you get much more control over (correct English?) what the GPU is doing and the distribution of work and resources between the CPU and the GPU.

The triangle program has 900 lines. Admittedly the program includes elements not strictly necessary (100 lines establishing validation layers and debug callbacks) and there may be simpler way of doing things, although the author says he a simplified a lot for this tiny project.. But I think I'll go back to openGL for the moment, and maybe try Vulkan again at a later stage. For what I need the API for, openGl will no doubt be fast enough, and it takes less time to do the job. OTOH, using Vulkan was FUN!!! So, maybe...

pibbuR who has written his first post on the newish site, and regrets that he's just as likely to produce typos as before. And who wonders why all the text is written with a horizontal line overstrike (Correct English?).

PS. Naming is very consistent, so quite often it's not difficult to predict what an identifier will be. DS.

PPS. The complete triangle program can be found at the bottom of this page: https://vulkan-tutorial.com/Drawing_a_triangle/Drawing/Rendering_and_presentation DS.

EDIT: Seems like I found out how to get rid of it.

EDIT 2: I did.
 
Last edited:
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Couchpotato

Burned Out Newsposter
Joined
Oct 1, 2010
Messages
29,887
Location
Spudlandia
I'm guessing pibbuR clicked one of the new forum buttons that crosses out text?

Like this.
 
Joined
Oct 1, 2010
Messages
29,887
Location
Spudlandia

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
Maybe. Don't remember doing that.

pibbuR who admits that doesn't say much.
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
FYI: Now, I've writtern the same program as the Vulkan one described above, this time using openGl (without the colouring, don't know how to do that yet).

58 lines of code.

pibbuR
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
That's indeed less verbose.
Isn't the result generally more performant with Vulkan? Not saying it's necessary in your case, not even sure that's the case, just curious.
It depends. I have not researched this topic thoroughly, but as far as I know it can vary between applications. Using Vulkan you have detailed control over what's going on, for instance the distribution of workload/resources between the CPU and the GPU. With higher level API's you are much more dependent on the whims of the drivers, and results may be more unpredictable. At least this is how I understand it at the moment. Feel free to shut u... eh .... correct me if I'm wrong.

GLuint pibbuR{}; glCreateBuffers(1, &pibbuR);

PS. I have started learning/expermineting with openGL in Qt, and I have followed a couple tutorials. ATM I am a bit confused. Qt's own GL functions have confusing names, and there doesn't seem to be a clear mapping between those and regular GL. You may create an application using most of the steps/functions used in a standalone application. But you don't have to, and most of the tutortials I've looked at don't. Actually, you can create GL applications without explicitly using any GL commands at all. Just create a class deriving from QOpenGLWidget, overload the paint event and then you can use the good old QPainter object, just like you did befopre you knew anyting about GL. Only this time, under the hood, there's a lot of GL stuff going on. I don't know how well this way of doing things performs, buf for 2D graphics it should be good enough. BTW, the Qt Groupe recommends using the QOpenGLWidget as baseline, adding more advanced GL stuff as needed. DS.

PPS. THIS IS FUN!!!! DS.
 
Last edited:
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Redglyph

SasqWatch
Joined
Aug 29, 2020
Messages
5,761
Location
Good old Europe
It depends. I have not researched this topic thoroughly, but as far as I know it can vary between applications. Using Vulkan you have detailed control over what's going on, for instance the distribution of workload/resources between the CPU and the GPU. With higher level API's you are much more dependent on the whims of the drivers, and results may be more unpredictable. At least this is how I understand it at the moment. Feel free to shut u... eh .... correct me if I'm wrong.
Oh I don't know anything about GPU graphics programming, I'm just being curious. I just saw a few posts and justifications on how Vulkan was better than OpenGL for X-Plane (and better than DirectX for DCS, another flight simulator).

I think they were very specific issues, and it was a while ago. It was about more fine-grained control, for example the way the shaders were used, and make them compile in advance to avoid stuttering, which is never fun when you're struggling against crosswind to land a plane and so on. ;) Also about a better use of the CPU when there are several cores, but that's for DCS which is still using DirectX. But I've not followed those discussions recently.

Qt and OpenGL sounds like a lot of fun!
 
Joined
Aug 29, 2020
Messages
5,761
Location
Good old Europe

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
A new bad programming language: BS.
View: https://www.youtube.com/watch?v=vcFBwt1nu2U


Some tl;dr;: Speaker wants to design a language by combining the worst elements from several well known (and in some cases fortunately forgotten) programming languages. The result is (if possibloe) worse than Intercal. So he succeeds, but it comes with a warning: Please (an Intercal command) don't make a compiler (which no doubt someone will want to do)!!!

Some more tl;dr: It's 60 minutes of fun.

pibbur who found severral languages he might try, especially APL (and Intercal).
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
A bit frustrated now.

I've started using CMAKE for my projects. I've learned the features I need, and it works very well. Mostly. I did my first experiments using VS Code, and when I felt I'd got the hang of it, I decided to use it under VS itself. VS (from 2017) supports VSCode. But then:
  1. "std::format requires C++ 20"
  2. "Can't open include file glfw/glfw3.h" (and a couple of other include files)
  3. "So I refuse to compile this".
But here's what my CMakelists.txt says:
  1. set(CMAKE_CXX_STANDARD 20)
  2. list(APPEND EXTRA_INCLUDES "C:/Utvikling/APIs/OpenGL/include")
  3. target_link_libraries(OogleProject01 PUBLIC ${EXTRA_LIBS})
Everything is as it should be. AND IT WORKS USING VS CODE!!!!!

//Looking for specific VS CMAKE examples.
Seems like VS studio wants the following changes
  1. cmake_minimum_required(VERSION 3.6.1) - to force using VS own CMAKE tools
  2. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc /std:c++latest")
Neither of these should be necessary. Then I (stupidly!) decided to remove the extras and try again. It works. WT*? Then suddenly it doesn't. Then it does-. Then it doesn't. Then ... Repeat until I_DO_NOT_BOTHER_ANYMORE.:

One thing are things that don't work. What's worse are things that suddenly start doing exactly that, and you have no idea why (solution can't be reproduced). Even worse are things that switch between working and failing, and you have no idea why. FRUSTRATION!!!

So I've made a decision.
  1. Use VS for .net things
  2. Use VS Code for CMAKE things.
  3. Use Qt Creator for Qt things (should also support CMAKE).

PIBBUR_WHO_BTW_IS_FASCINATED_BY_THE_LONG_NAMES_USED_BY_OPENGL
 
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Myrthos

Cave Canem
Joined
Aug 30, 2006
Messages
11,212
I never used VS with an existing CMake file. I always had VS make it by going through all the options to make it behave as I wanted it to behave (which was never what it did by default). Then again, I also found that VS was hard to configure properly for anything that it didn't support out of the box. It is not really designed to be such a generic IDE.
 
Joined
Aug 30, 2006
Messages
11,212

pibbuR

Feeling ... lonely?
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway
I agree.

I must say I'm quite impressed with VS code. Works very well with CMAKE. And all those extensions should make it suitable for almost anything (?) - problem is: what to choose. For openGL work several glsl shadcer extensions are avaiable. I'm going for glsl canvas since apparently that one can preview results of the fragment shader - haven't tried it yet.

One thing VS is good at (in addition to the .net environment) is support for C++ 20, bot the compiler and intellisense now support (nearly?) all new C++ features (and experimental C++ 22 support is on the way). While for instance Qt Creator still, AFAIK, doesn't support modules out-of-the box (there may be ways of achieving that, but so far I haven't found it).

C++:
PibbuR::pibbuR(){};//fixed
 
Last edited:
Joined
Nov 11, 2019
Messages
1,172
Location
Bergen@Norway

Myrthos

Cave Canem
Joined
Aug 30, 2006
Messages
11,212
Smilies and C++ don't go well together :)

for some things there are just too many add-ons in VS Code. I tend to look at number of installments. A high number might mean it is useful? And I check whether or not it still gets some attention, by looking at when it was updated recently.

The number of installments isn't always good to go by. Phpcs for example (a code checker for PHP). There are two of them and the one with the highest number of installments is not the one to choose as it has been abandoned. Someone has forked it and is still maintaining that forked version, so the one with the lower amount of installs is better. But finding all that stuff out can be quite time consuming.
Fortunately it is not that difficult to switch between add-ons.
 
Joined
Aug 30, 2006
Messages
11,212
Top Bottom