So here's a part of my code, what I'm trying to do is to make a HBITMAP from a OpenGl frame capture.
unsigned char *output = 0;
output = new unsigned char[WINDOW_WIDTH * WINDOW_HEIGHT * 3];
glReadPixels(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, GL_RGB, GL_UNSIGNED_BYTE,
output);
HBITMAP hdm = CreateBitmap(800, 800, 1, 32, output);
But my (HBITMAP)hdm is always NULL. Maybe there's another way to do that or what's wrong? I guess CreateBitmap would allocate memory itself, so the mistake must not be here. The output array seems to be fine though.
I've also tried the code from here: Creating a HBITMAP from glReadPixels but it didn't work as well, still getting NULL.
Would appreciate any help with this!