Joystick and opengl

Hi!
I’m new to the list but I searched the list archives and couldn’t see the answer to my problem:
I’m using a joystick in opengl and want the SDL abilities since GLUT is limited. However SDL only reads my stick when a change is made. If I push the stick to the limit in one direction and hold it there then nothing is being read. I want the stick values to be continuously accessed. I can do this in GLUT by using the command glutForceJoystickFunc(); in the Idle() function. Is there a similar command in SDL?
Thanks,
Barry

I'm new to the list but I searched the list archives and couldn't

see the answer to my problem: I’m using a joystick in opengl and want
the SDL abilities since GLUT is limited. However SDL only reads my
stick when a change is made. If I push the stick to the limit in one
direction and hold it there then nothing is being read. I want the
stick values to be continuously accessed. I can do this in GLUT by
using the command glutForceJoystickFunc(); in the Idle() function.
Is there a similar command in SDL? Thanks, Barry

Why can’t you store the last value and act on that once per frame as if it
were a new event?

–ryan.

Exactly. You’re not adding information by breaking the "send on change only"
mechanism; you’re removing information. Pretty useful information at that,
especially if you have a lot of calculations to do for every new joystick
position.

Besides, it’s generally a good idea to separate your input code from the
actual game engine anyway. For example, you can throw in various translation
code (rotating the joystick by 45 degrees, scaling, reversing, non-linear
response etc) in between the input API and the engine without messing up the
engine’s control system.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Thursday 28 June 2001 11:42, Ryan C. Gordon wrote:

I'm new to the list but I searched the list archives and couldn't

see the answer to my problem: I’m using a joystick in opengl and want
the SDL abilities since GLUT is limited. However SDL only reads my
stick when a change is made. If I push the stick to the limit in one
direction and hold it there then nothing is being read. I want the
stick values to be continuously accessed. I can do this in GLUT by
using the command glutForceJoystickFunc(); in the Idle() function.
Is there a similar command in SDL? Thanks, Barry

Why can’t you store the last value and act on that once per frame as if it
were a new event?

Thanks!
I put the “continuing” code in as a call from process_events and it
works fine. I appreciate the comments!
Barry> ----- Original Message -----

From: david.olofson@reologica.se (David Olofson)
To:
Sent: Thursday, June 28, 2001 10:20 AM
Subject: Re: [SDL] joystick and opengl

On Thursday 28 June 2001 11:42, Ryan C. Gordon wrote:

I'm new to the list but I searched the list archives and couldn't

see the answer to my problem: I’m using a joystick in opengl and want
the SDL abilities since GLUT is limited. However SDL only reads my
stick when a change is made. If I push the stick to the limit in one
direction and hold it there then nothing is being read. I want the
stick values to be continuously accessed. I can do this in GLUT by
using the command glutForceJoystickFunc(); in the Idle() function.
Is there a similar command in SDL? Thanks, Barry

Why can’t you store the last value and act on that once per frame as if
it

were a new event?

Exactly. You’re not adding information by breaking the "send on change
only"
mechanism; you’re removing information. Pretty useful information at
that,
especially if you have a lot of calculations to do for every new joystick
position.

Besides, it’s generally a good idea to separate your input code from the
actual game engine anyway. For example, you can throw in various
translation
code (rotating the joystick by 45 degrees, scaling, reversing, non-linear
response etc) in between the input API and the engine without messing up
the
engine’s control system.

file://David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -’