是否有类似于glReadPixels
的函数可以将内容直接写到输出流?我试图避免复制任何数据。目前,我分配了一个vector
,然后必须将vector
写到这样的流中:
std::array<unsigned char, 3 * height * width> data;
glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data.data());
stream.write(reinterpret_cast<const char *>(&data_[0]), data_.size() * sizeof(unsigned char));