The general form of a line equation is given as . Given two points and , we can compute coefficients , , and as follows. First, compute the slope as rise over run . Second, plug this value and one of the points into the point-slope form, given by , and gather all terms on the lefthand side:
Category Archives: Programming
Desktop Duplication on Hybrid Graphics Systems
The Desktop Duplication API allows applications to access frame-by-frame updates to the desktop image associated with a particular DXGI output as a DXGI surface. For hybrid graphics systems, there is a well-known issue that occurs when an application is run on one GPU but attempts to duplicate output from another GPU that is merely acting as a shim for the first. In the case of hybrid graphics laptops, this corresponds to the application being run on the discrete GPU and duplicating the laptop display which is generally connected to an integrated GPU. IDXGIOutput1::DuplicateOutput will fail with DXGI_ERROR_UNSUPPORTED.
Microsoft’s recommended fix for this error is to run the application on the appropriate GPU; in the case of hybrid laptops, this will usually correspond to the integrated (low-power) GPU. Fortunately for application developers, there are programmatic ways of forcing an executable to run on a certain GPU. For NVIDIA Optimus systems, you can use NVAPI to create an application profile and set the relevant flag. For AMD PowerXpress systems, the situation is murkier. Finally, in Windows 10 Build 17093, Microsoft introduced an abstraction that overrides any vendor-specific GPU preference. This abstraction is configurable by programmatically setting a registry value.
Continue readingCustom Icons in Unreal Engine 4
If you’re building your own custom actors and components in Unreal Engine 4, then at some point you’ll want to give them a nice icon instead of the default generic one. It’s actually pretty easy to do, but it took me quite a bit of digging since I couldn’t find a ready-made guide. It boils down to the following:
- Create a SlateStyleSet
- Set its ContentRoot and CoreContentRoot properly
- Register SlateImageBrushes for your actor or component
- Register your SlateStyleSet
- Register your SlateStyleSet as an icon source
Achievement Unlocked: Host a Twitch Session
This Twitch session comes on the heels of releasing the Phonon 3D plugin for Unreal Engine 4. In the video, I go over how to get 3D audio up and running in a simple Blueprint project.
Note that at the end I get a little confused by the audio settings. For the record, I was right in the first instance: you can mix HRTF and panning in a single scene.
Thanks to @anishchandak and @LakulishAntani for all the great feedback before the live stream. Hoping to do more in the future!