News for hackers. Stuff that matters.
Re:ChosunTruck – Euro Truck Simulator 2 autonomous driving s... by omegaham on Thursday February 16, 2017 @10:02AM (#13660335)
> Can anyone comment on how this is actually obtaining the video output from ETS2?

In Windows, it's done by grabbing the handle of the window with the "Prism3D" classname.

This then goes to the hwnd2mat function[1], which does `GetDC`[2] to get the device content and then creates a bitmap with `CreateCompatibleBitmap`[3].

---

On Linux[4], it's done by grabbing the screen with `XOpenDisplay` and the current window with `DefaultRootWindow`. It then uses `XGetImage` and memcpys the result into the vector of pixels.

Note that the `main` function in the Windows and Linux version is slightly different to accommodate the difference in how these images are grabbed.

[1] https://github.com/bethesirius/ChosunTruck/blob/master/windo...

[2] https://msdn.microsoft.com/en-us/library/windows/desktop/dd1...

[3] https://msdn.microsoft.com/en-us/library/windows/desktop/dd1...

[4] https://github.com/bethesirius/ChosunTruck/blob/master/linux...

There are no comments on this comment yet.