Using windows colour macros in openGL


I’m using the statement glColor3f to set the colours in my program, but I need to use windows default colours. I was wondering if anyone could tell me how to use windows colour macros such as COLOR_ACTIVEBORDER, COLOR_BACKGROUND, COLOR_MENU etc. to set colours for openGL graphics primatives.



The Windows API function GetSysColor returns a packed RGB triple. To extract the individual red, green and blue components you can use the Get(R|G|B)Value macros, then supply the returned components to glColor3ub(reg,green,blue). You could also normalize the components by dividing each by 255.0, then calling glColor3f, for example.


  • Great. Thanks very much.