PDA

View Full Version : How can OpenGL program response to hardware input?



bluestone
08-12-2004, 10:30 PM
I want to build a program that can response to hardware inputting observer position data,How can I make the data inputting interrupt trigger the scene render?
Any suggestion? thank you very much!
I used the glutDisplayFunc(RenderScene) before,but it can only response to mouse,window size,and window position data,not other interruptes.

08-13-2004, 07:15 AM
Well, openGL clearly states itself as beeing platform-independent, so you have to resort to the specific capabilities of your platform.

It depends on if you are using a windowing kit such as wxWidgets or the native api. On win32, you can call GetAsyncKeystate() and get the current pressed states of the keys. I have no clue about XWindow, but I think its done through a callback.

Either way, OpenGL has nothing to do with user input.

08-13-2004, 07:18 AM
Oh sorry, seems you are looking for an interface for some specialized hardware?
Please detail yourself some more.

Thermo

bluestone
08-16-2004, 01:46 AM
thanks for your reply!
I have to input the observer position data from a PCI device,the hardware works something like a joystick,the scene redisplay dynamically as a result of the input data.

I used the glutDisplayScene() CALLBACK function previously,but now I want to get out from the glutDisplayScene() function.Do I have to put the codes that reading the input data in a CALLBACK function? seems I have to get to know the way glutDisplayScene() works.

ZbuffeR
08-16-2004, 01:50 PM
Either you register a callback to handle your special input and call glutPostRedisplay at the end, or you can do polling on the glutIdleFunc, then call glutPostRedisplay when you need to update the window.

Hope it helps.

08-16-2004, 01:56 PM
If its a PCI device you need some sort of driver. In your OpenGL application you can for example poll that driver based on a timer and update your data and then (in case of Glut) do a glutPostRedisplay() to have your data redrawn with the new data.

But honestly this isnt really a OpenGL question since the problem seems to be the interface to that PCI device and OpenGL has no knowledge about that and neither do I or most of the people here I dare say.

Perhaps asking this in a forum that is focused more on the Windows device driver kit (DDK) would yield better results.