glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, temp);
check_error();
if (format == GL_ALPHA) {
glReadPixels(0, 0, width, height, GL_RGBA, GL_FLOAT, temp);
check_error();
if (format == GL_ALPHA) {
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, temp);
check_error();
if (format == GL_ALPHA) {
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, temp);
check_error();
if (format == GL_ALPHA) {