Handmade Hero»Forums»Code
Marius Adaškevičius
22 posts
Day 164: Antialiasing
Edited by Marius Adaškevičius on
There is a note in MSDN which states that one should pass HDC that was used to create the memory device context to create a color bitmap. Otherwise, a monochrome bitmap is created because that is the initial format of a selected bitmap when a memory device context is created.

Note: When a memory device context is created, it initially has a 1-by-1 monochrome bitmap selected into it. If this memory device context is used in CreateCompatibleBitmap, the bitmap that is created is a monochrome bitmap. To create a color bitmap, use the HDC that was used to create the memory device context.

So to get antialiasing working one would just need to pass the device context of the screen (via GetDC(0)) as the first argument to CreateCompatibleBitmap.
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
Day 164: Antialiasing
Sweet! We'll try that and see if it gets our antialiasing back.

- Casey