glut and gamepads under linux!

Hi all gamedev-ers!

I am writing some OpenGl code,
using glut to “talk” with the X11 stuff.
Now i wanted to add support for an
USB gamepad, but… i dunno where to start:
I correctly installed the gamepad
(i know cause i see output cat-ing the
/dev/input/js0 file). But other than
that i can’t see how to get the joy callback
running in the app…

thanks for the help!! :slight_smile:

Well, you might be in for a dissapointment here. I don’t think that glut can handle joysticks. SDL might be a better solution here.
But just to make certain, check the glut manual here
and see what types of input it supports. I could be wrong.

Upon inspecting the manual myself, I’m not sure if you could register the spaceball callbacks and get joystick input from there. Maybe by piping the corresponding /dev/* entry? Just an idea though. Good luck :wink:

An API for working with the joystick under linux is described here.

I have used it under v2.6 and it works fine. There is an RPM that has the API description, header files and some programs for calibrating your device. I am not sure if it is being updated.

As dvm said, SDL or a similar framework is good solution that can save you from a lot of platform specific, graphics-unrelated and tedious work that many have implemented and debugged already.

  • SFRuckus