PDA

View Full Version : glReadPixels how to get larger window content?



wangsen1312
05-10-2017, 04:13 AM
I want to get the window content from OpenGL to OpenCV. The code used below:

unsigned char* buffer = new unsigned char[ Win_width * Win_height * 4];
glReadPixels(0, 0, Win_width, Win_height, GL_BGRA, GL_UNSIGNED_BYTE, buffer);
cv::Mat image_flip(Win_height, Win_width, CV_8UC4, buffer);

When the window size is small. everything is fine.
But when Win_width and Win_height large than 1080p, the image will be resize to 1080p and other part will pad with grey.