Creating an RGB DIB rather than BGR DIB

Windows is normally BGR rather than RGB.

There is however away of creating a HBITMAP backed by a DIB which is RGB.

The trick is to use the following extra settings:

    bmi->bmiHeader.biCompression = BI_BITFIELDS;
    bmi->bmiColors[0].rgbBlue = 0xff;
    bmi->bmiColors[1].rgbGreen = 0xff;
    bmi->bmiColors[2].rgbRed = 0xff;

Everything else is kept the same.

This means that you no longer need to swap Red and Blue or tell OpenGL that you are passing BGR.

NOTE: The structure BITMAPINFO only contains one RGBQUAD so you need to create a BITMAPINFO  plus two extra RGBQUADs.