I also shortened the init function to this:
void glcd_init(void){
pinMode(CS_PIN, OUTPUT);
SPI.begin();
glcd_cmd(FUNCTION_SET_BASIC);
glcd_cmd(FUNCTION_SET_BASIC);
glcd_cmd(ENTERY_MODE);
glcd_cmd(DISPLAY_CONTROL);
glcd_task_flag = FINISHED;
}
I removed these two lines:
glcd_cmd(DISPLAY_CLEAR);
CO_DELAY(16000);
It doesn't do much of a difference, because I will call the function that clears the pixels after initialization.