I'm using openGL using GLUT. I'm making my own header file with some functions. One of them is a rectangle where you can enter digits and save them. the problem here is that the if I want to know wich key is pressed, I need to put the function in de keyboardFunc callback, but I also want to display the rectangle, so I also need to put it in the display callback because you can't draw anything in the keyboard callback function.
I can make two functions: one for to display the rectangle and one for the keys, but I want one function for both. How can I do this?