以编程方式将击键发送到 GLUT 应用程序
我的 Linux 机器上运行着一个 OpenGL/GLUT 程序,它可以从各个角度查看 3D 模型并截取屏幕截图,一切都可以通过键盘控制。 我想编写一个以特定方式围绕模型移动的脚本,在每一步都进行屏幕截图。 看来 Linux 中应该有一种简单的方法可以从脚本将击键发送到该应用程序。 有人知道怎么做吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
获取 GLUT 源代码并使其可远程控制。 一种方法是删除轮询键盘的函数并让它轮询套接字。 将程序与新库的现有程序链接起来。
之后,您可以建立与现在可远程控制的程序的连接,并从您的应用程序以编程方式设置键代码。
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.
您可以将事件注入到 X11 窗口中。 我认为 xnee 会为你做到这一点。 我认为“检查”(使用 Tk 的功能?)也曾经用来执行此操作。
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.