I have an OpenGL window, and a wxWidget dialog. I want to mirror the OpenGL to the dialog. So what I intend to do is:
- Capture the screenshot of the opengl
- Display it onto the wxwidgets dialog.
Any idea?
Update: This is how I currently use glReadPixels (I also temporarily use FreeImage to save to BMP file, but I expect the file saving to be removed if there's a way to channel it directly to the wxImage)
// Make the BYTE array, factor of 3 because it's RBG.
BYTE* pixels = new BYTE[ 3 * width * height];
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
// Convert to FreeImage format & save to file
FIBITMAP* image = FreeImage_ConvertFromRawBits(pixels, width, height, 3 * width, 24, 0x0000FF, 0xFF0000, 0x00FF00, false);
FreeImage_Save(FIF_BMP, image, "C:/test.bmp", 0);
// Free memory
delete image;
delete pixels;