Monday, 21 October 2019

OBS Studio with dual graphics

Here is how to set any app to always run on a particular GPU: https://www.tenforums.com/tutorials/103965-set-preferred-gpu-apps-windows-10-a.html. A well-hidden feature. Set OBS Studio to always run on Intel. By default it runs on NVidia, which makes it not work — lagging for minutes, not showing capture, etc.

Thursday, 10 October 2019

Getting along with qwt on Qt

Smooth experience with Qwt on Windows with Visual Studio.
  1. Build qwt on Windows: https://www.qtcentre.org/threads/66576-Installing-Qwt-with-MSVC-2015-64bit-compiler-on-Windows-(complete-instructions) — that works on VS-2019 as well.
  2. You will need QtDesigner with VS. Install a plugin: copy from qwt-6.1.4\plugins\designer\ to qt\5.13.1\msvc2017_64\plugins\designer\. Run qt\5.13.1\msvc2017_64\bin\designer.exe and see this at Help → About Plugins:
  3. You also need a plugin at QtCreator. It is a 32-bit app :( So you compile qwt for 32-bit, keep it fully separately from 64-bit one (i.e. unzip your qwt downloadable to a separate folder again, name it qwt-x86-6.1.4). Copy qwt-x86-6.1.4/plugins/designer/qwt_designer_plugin.dll to qt/Tools/QtCreator/bin/plugins/designer. Create a Widget application, go to a form and find this in the panel:
  4. Create a VS Qt project, then export a QtCreator project from it. Use both.

Friday, 4 October 2019

Initialization in modern C++

Initialization in C++ is unreasonably hard. There are 19 ways to initialize an int, leading to quite different results depending on the case. Copying initialization is a bogus. Move semantics makes all that ever more harder: https://www.youtube.com/watch?v=PNRju6_yn3o.

There are improvements coming in C++20 though: https://habr.com/ru/company/jugru/blog/469465/ related to homogenizing curly-braced and parenthesis initializations. This funny stuff is also fixed: https://youtu.be/AgatxxXNwBM?t=390 (in a funny way as well).

My own rule of thumb so far:
  • always avoid copy initialization,
  • use curly-braced initialization everywhere,
  • don't use parenthesis initialization.
That shall remain even with the coming of (args) and {args} homogenization in C++20, as {} prevents narrowing conversions which you usually don't want.