Why Glut Post Red Display isnt working?

#Question
How to use GlutPOstRedisplay to render screen again and again...
#My Workings
I worked on the following code.... But not endering windows even for single time i dont know why...!
#CODE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void NonPrintableKeys(int key, int x, int y) {
	if (key
			== GLUT_KEY_LEFT /*GLUT_KEY_LEFT is constant and contains ASCII for left arrow key*/) {
	x  -= 100;	// what to do when left key is pressed...
	} else if (key
			== GLUT_KEY_RIGHT /*GLUT_KEY_RIGHT is constant and contains ASCII for right arrow key*/) {
        x += 100;
	} else if (key
			== GLUT_KEY_UP/*GLUT_KEY_UP is constant and contains ASCII for up arrow key*/) {
        y += 100;
	}

	else if (key
			== GLUT_KEY_DOWN/*GLUT_KEY_DOWN is constant and contains ASCII for down arrow key*/) {
	y -= 100;
	}

	/* This function calls the Display function to redo the drawing. Whenever you need to redraw just call
	 * this function*/
	glutPostRedisplay();

}

Last edited on
if you have global `x', `y' variables, notice that you are not modifying those in the NonPrintableKeys() function.
Instead you are modifying local variables, so your function has no effect.
Topic archived. No new replies allowed.