hi all. i was trying to make a cube that ive drawn on the screen flicker between 2 colors, but instead it changes color whenever i click on the screen. here are the relevant portions of my code.

here is the freeglut initialization:
Code :
int main(int argc, char **argv){
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA);
    glutInitWindowSize(512,512);
    glutInitContextVersion(4,3);
    glutInitContextProfile(GLUT_CORE_PROFILE);
 
    glutCreateWindow("Test Programs");
 
    init();
 
 
    glutDisplayFunc(display);
 
    glutMainLoop();
 
    return 0;
 
}

here is my fragment shader:
Code :
const char *fshader =
	    	    "#version 430 core\n"
	    		"out vec4 fColor;\n"
	    		"uniform vec4 Color;\n"
	    	    "void main()\n"
	    	    "{\n"
	    	    "fColor = Color;\n"
	    	    "}\n";

and here is the part of my display function that should cause it to flicker:
Code :
if (!colorswitch)
	{
		glUniform4f(colorloc, color1[0], color1[1], color1[2], color1[3]);
		colorswitch = !colorswitch;
	}
	else if (colorswitch)
	{
		glUniform4f(colorloc, color2[0], color2[1], color2[2], color2[3]);
		colorswitch = !colorswitch;
	}

i just want the cube to flicker between colors. any ideas?