Reputation:

Programmatically send keystrokes to GLUT application

I have an OpenGL/GLUT program running on my linux machine that views a 3D model from various angles and can take screenshots, and everything is controlled from the keyboard. I want to write a script that moves around the model in a particular way, taking screenshots at every step. It seems there should be a simple way in Linux to send keystrokes to this application from a script. Anyone know how?

Upvotes: 0

Views: 1506

Answers (2)

ejgottl
ejgottl

Reputation: 2829

You can inject events into an X11 window. I think xnee will do that for you. I think that "inspect" (using a feature of Tk?) used to do this as well.

Upvotes: 0

Nils Pipenbrinck
Nils Pipenbrinck

Reputation: 86363

Take the GLUT source-code and make it remote controllable. One way to do this is to remove the function that polls the keyboard and let it poll a socket instead. Link the program with the existing program with the new library.

Afterwards you can establish a connection to the now remote-controllable program and set key-codes programmatically from your app.

Upvotes: 1

Related Questions