If you want to build a string, you can use snprintf() :
const unsigned red = 0, green = 0x19, blue = 0x06; char hexcol[16]; snprintf(hexcol, sizeof hexcol, "%02x%02x%02x", red, green, blue);
This will lead to the construction of line 001906" in hexcol`, so I decided to interpret your approximate color (these are just four digits, when there should be six).
You seem confused by the fact that the GL_ALPHA preprocessor GL_ALPHA is defined as 0x1906 in OpenGL header files. This is not a color, it is a format specifier used with OpenGL API calls that deal with pixels, so they know what format to expect.
If you have a PNG image in memory, the GL_ALPHA format will correspond only to the alpha values ββin the image (if any), then this is completely different, since it builds a string. OpenGL does not need a string, for this you need a buffer in memory containing data in the desired format.
See the glTexImage2D() man page for a discussion of how this works.
unwind
source share