#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
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...
} elseif (key
== GLUT_KEY_RIGHT /*GLUT_KEY_RIGHT is constant and contains ASCII for right arrow key*/) {
x += 100;
} elseif (key
== GLUT_KEY_UP/*GLUT_KEY_UP is constant and contains ASCII for up arrow key*/) {
y += 100;
}
elseif (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();
}
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.