Interfacing Space Pilot using OpenGL

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
jubin
Posts: 3
Joined: Thu Jul 24, 2008 3:46 am

Interfacing Space Pilot using OpenGL

Post by jubin »

Hi everyone,
I am trying to interface the space pilot for a program in OpenGL. Any out there having any views and suggestions are requested to share it. Thank you.
U can mail me to [email protected]
jwick
Moderator
Moderator
Posts: 3455
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Post by jwick »

You have a couple of directions depending on the structure of the app.

If the app makes use of COM, it may be easiest to use our 3DxInput COM API.

If it is a Win32 or MFC app, you can use our "old SDK" (from the download...archive section of the web page).

If it is a game, you may find that DirectInput will be the easiest integration method.

If it doesn't have a GUI, you may have to use HID or RawInput.
mfalda
Posts: 4
Joined: Sat Mar 28, 2009 9:31 am

Support for OpenGLUT (win32)

Post by mfalda »

I have included the code of the 3DxTest32 example in OpenGLUT and I have added two call-back functions:

Code: Select all

void glutSpaceballButtonFunc(int button, int state);
and

Code: Select all

void glutSpaceballMotionFunc(int tx, int ty, int tz, int rx, int ry, int rz);
In this way, the minimal example is as simple as:

Code: Select all

#include <GL>
#include <stdio>

void sbButton(int button, int state)
{
	printf("%d, %d\n", button, state);
}

void sbMotion(int tx, int ty, int tz, int rx, int ry, int rz)
{
	printf("%d, %d, %d, %d, %d, %d\n", tx, ty, tz, rx, ry, rz);
}

int main(int argc, char** argv)
{
   glutInit(&argc, argv);
   glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
   glutInitWindowSize (500, 500); 
   glutInitWindowPosition (100, 100);
   glutCreateWindow (argv[0]);
   glutSpaceballButtonFunc (sbButton);
   glutSpaceballMotionFunc (sbMotion);
   glutMainLoop();
   return 0;
}
I am now working at the Linux version, but I have still some problems with the call-backs (besides the fact that, to keep up-to-date the display, I must put a call to glutPostRedisplay in the glutIdleFunc, but this happens also in the original code). I do not own a Mac, so by now that OS is not in my plans, a closer objective would be the inclusion into the GL C++ Toolkit.

I will donate the source code to the original project, which is now "dormant"; meanwhile I have put the library here: http://www.dei.unipd.it/~hyksos/OpenGLUT_sb.zip
greenie
Posts: 5
Joined: Thu Aug 13, 2009 6:38 am

Post by greenie »

also try submit it to freeGlut.
Developers are still hanging around there.
infact I came here to the forum. To have a look at how difficult it is and implement it in freeglut.
mfalda
Posts: 4
Joined: Sat Mar 28, 2009 9:31 am

Post by mfalda »

Thank you for the suggestion, I have posted my code there. Meanwhile I could compare the sources of OpenGLUT and FreeGLUT to figure out how much differences there are, and possibly work on the latter.
mfalda
Posts: 4
Joined: Sat Mar 28, 2009 9:31 am

Post by mfalda »

I have completed the Linux version for OpenGLUT and I have also applied the support to FreeGLUT: now there is a starting point for developing with SpaceNavigator in Windows and Linux using OpenGL. You can find the precompiled libraries here:
I have sent the code to the FreeGLUT developers, in the hope that they will include it in future versions and they will add OSX support.
Post Reply