I have some basic code to collect key up and key down events using glut.
If I hold a key down I am getting continuous events firing (down/up/down/up/down/up/........), instead of the intended down (once, at the start) and up (once, at the end)
#include <GL/glut.h>
#include <iostream>
void keyDown (unsigned char key, int x, int y)
{
std::cout << "keydown " << key << "\n";
}
void keyUp (unsigned char key, int x, int y)
{
std::cout << "keyup " << key << "\n";
}
void render(void)
{
std::cout << "render\n";
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(300, 300);
glutInitWindowPosition(100, 100);
glutCreateWindow("Hello world :D");
glutDisplayFunc(render);
glutKeyboardFunc(keyDown);
glutKeyboardUpFunc(keyUp);
glutMainLoop();
return 0;
}
Any input appreciated. Thanks