void texture_write_to_file(texture* t, char* filename){ image* i = texture_get_image(t); image_write_to_file(i, filename); image_delete(i); }
void graphics_viewport_screenshot() { unsigned char* image_data = malloc( sizeof(unsigned char) * graphics_viewport_width() * graphics_viewport_height() * 4 ); glReadPixels( 0, 0, graphics_viewport_width(), graphics_viewport_height(), GL_BGRA, GL_UNSIGNED_BYTE, image_data ); image* i = image_new(graphics_viewport_width(), graphics_viewport_height(), image_data); free(image_data); timestamp(timestamp_string); screenshot_string[0] = '\0'; strcat(screenshot_string, "./corange_"); strcat(screenshot_string, timestamp_string); strcat(screenshot_string, ".tga"); image_write_to_file(i, screenshot_string); image_delete(i); }