I have the following code:
unsigned char* frame_buffer_data{ new unsigned char[data_size] };
glReadPixels(origin_x, origin_y, width, height, GL_BGR, GL_UNSIGNED_BYTE, frame_buffer_data);
I want to get rid of the raw pointer (frame_buffer_data
) and use a unique pointer.
Trying this:
std::unique_ptr<unsigned char> framebuffer_data(new unsigned char[data_size] );
does not work.
How can I pass the unique pointer (or other smart pointer) to this function?
After the call to glReadPixels
I need to be able to reinterpret cast
the data type and write the data to a file, like so:
screenshot.write(reinterpret_cast<char*>(frame_buffer_data), data_size);