Where's the SDK?
Moderator: Moderators
Where's the SDK?
Where do I get the SKD? The CD-ROM that came w/ the product doesn't seem to contain it and it doesn't seem to be online under the SDK download page (http://www.3dconnexion.com/support/4f.php).
What I'm looking for is all the files referred to in WindowsSDKGuide.pdf: i.e. files in %SDK% which by default is C:\Program Files\3Dconnexion\3DxWare SDK\
Thanks for the help
What I'm looking for is all the files referred to in WindowsSDKGuide.pdf: i.e. files in %SDK% which by default is C:\Program Files\3Dconnexion\3DxWare SDK\
Thanks for the help
Hi mika,
how do you interface w/ python?
My attempt so far:
import win32com.client
sn = win32com.client.Dispatch("TDxInput.Device")
sn.Connect()
print sn.Type
6
print sn.Sensor.Translation.X
0.0
I always get 0.0 no matter what i do, or which axis Trans/Rot
i query (yes i've been moving it
)
Hints & pointers appreciated, pref src.
SpaceNavigator 3.3.2
Patric
how do you interface w/ python?
My attempt so far:
import win32com.client
sn = win32com.client.Dispatch("TDxInput.Device")
sn.Connect()
print sn.Type
6
print sn.Sensor.Translation.X
0.0
I always get 0.0 no matter what i do, or which axis Trans/Rot
i query (yes i've been moving it
Hints & pointers appreciated, pref src.
SpaceNavigator 3.3.2
Patric
still questions
dear jwick,
i dont understand why the pdf about the WindowsSDKguide still refers about the sdk-install options.
i was looking forward to program, but it isnt that easy.
the code samples wont run with msvs6 and there has to be more than just one dll. in the pdf many libs are mentioned and i would be glad if we get a bit more information where to get them.
there was talked about an archive on this homepage, but i cant find an archive where i can download older source-files.
i dont understand why the pdf about the WindowsSDKguide still refers about the sdk-install options.
i was looking forward to program, but it isnt that easy.
the code samples wont run with msvs6 and there has to be more than just one dll. in the pdf many libs are mentioned and i would be glad if we get a bit more information where to get them.
there was talked about an archive on this homepage, but i cant find an archive where i can download older source-files.
Hi rxnnxs,
Please make sure you check the documentation available on the SDK page (not the Archive).
The 3Dconnexion SDK page is available here. You will find in there a link to a web seminar presentation that can be very useful to get you started.
Please make sure you check the documentation available on the SDK page (not the Archive).
The 3Dconnexion SDK page is available here. You will find in there a link to a web seminar presentation that can be very useful to get you started.
Nuno Gomes
-
Martijn Kragtwijk
- Posts: 3
- Joined: Wed May 16, 2007 7:09 am
-
Martijn Kragtwijk
- Posts: 3
- Joined: Wed May 16, 2007 7:09 am
Ok folks, I've managed to get something working myself, based on a NeHe example (using pyopengl). Looks like this:
What struck me as odd is that the rotation values seem to be either exactly 0.0 or 1.0 or -1.0 when I have only one axis rotated, and something in between when more than one axis is non-zero. Is this normal?
Martijn
Code: Select all
#!/usr/bin/env python
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
import sys
import win32com.client
sn = win32com.client.Dispatch("TDxInput.Device")
sn.Connect()
ESCAPE = '\033'
# Number of the glut window.
window = 0
x = 0
y = 0
z = 0
rot_x = 0
rot_y = 0
rot_z = 0
# A general OpenGL initialization function. Sets all of the initial parameters.
def InitGL(Width, Height): # We call this right after our OpenGL window is created.
glClearColor(0.0, 0.0, 0.0, 0.0) # This Will Clear The Background Color To Black
glClearDepth(1.0) # Enables Clearing Of The Depth Buffer
glDepthFunc(GL_LESS) # The Type Of Depth Test To Do
glEnable(GL_DEPTH_TEST) # Enables Depth Testing
glShadeModel(GL_SMOOTH) # Enables Smooth Color Shading
glMatrixMode(GL_PROJECTION)
glLoadIdentity() # Reset The Projection Matrix
# Calculate The Aspect Ratio Of The Window
gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)
glMatrixMode(GL_MODELVIEW)
# The function called when our window is resized (which shouldn't happen if you enable fullscreen, below)
def ReSizeGLScene(Width, Height):
if Height == 0: # Prevent A Divide By Zero If The Window Is Too Small
Height = 1
glViewport(0, 0, Width, Height) # Reset The Current Viewport And Perspective Transformation
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(45.0, float(Width)/float(Height), 0.1, 100.0)
glMatrixMode(GL_MODELVIEW)
def updateSensorData():
global x, y, z, rot_x, rot_y, rot_z
Tx = float(sn.Sensor.Translation.X)
Ty = sn.Sensor.Translation.Y
Tz = sn.Sensor.Translation.Z
Rx = float(sn.Sensor.Rotation.X)
Ry = sn.Sensor.Rotation.Y
Rz = sn.Sensor.Rotation.Z
print 'Tx', Tx,
print 'Ty', Ty,
print 'Tz', Tz,
print 'Rx', Rx,
print 'Ry', Ry,
print 'Rz', Rz
x += 0.01*Tx
y += 0.01*Ty
z += 0.01*Tz
rot_x += Rx
rot_y += Ry
rot_z += Rz
# The main drawing function.
def DrawGLScene():
global x, y, z, rot_x, rot_y, rot_z
updateSensorData()
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); # Clear The Screen And The Depth Buffer
glLoadIdentity()
glTranslatef(0.0, 0.0,-7.0) # Move Right And Into The Screen
glTranslate(x, y, z)
glRotatef(rot_x, 1.0, 0.0, 0.0)
glRotatef(rot_y, 0.0, 1.0, 0.0)
#glRotatef(rot_z, 0.0, 0.0, 1.0)
#glRotatef(rquad,1.0,1.0,1.0) # Rotate The Cube On X, Y & Z
glBegin(GL_QUADS) # Start Drawing The Cube
glColor3f(0.0,1.0,0.0) # Set The Color To Blue
glVertex3f( 1.0, 1.0,-1.0) # Top Right Of The Quad (Top)
glVertex3f(-1.0, 1.0,-1.0) # Top Left Of The Quad (Top)
glVertex3f(-1.0, 1.0, 1.0) # Bottom Left Of The Quad (Top)
glVertex3f( 1.0, 1.0, 1.0) # Bottom Right Of The Quad (Top)
glColor3f(1.0,0.5,0.0) # Set The Color To Orange
glVertex3f( 1.0,-1.0, 1.0) # Top Right Of The Quad (Bottom)
glVertex3f(-1.0,-1.0, 1.0) # Top Left Of The Quad (Bottom)
glVertex3f(-1.0,-1.0,-1.0) # Bottom Left Of The Quad (Bottom)
glVertex3f( 1.0,-1.0,-1.0) # Bottom Right Of The Quad (Bottom)
glColor3f(1.0,0.0,0.0) # Set The Color To Red
glVertex3f( 1.0, 1.0, 1.0) # Top Right Of The Quad (Front)
glVertex3f(-1.0, 1.0, 1.0) # Top Left Of The Quad (Front)
glVertex3f(-1.0,-1.0, 1.0) # Bottom Left Of The Quad (Front)
glVertex3f( 1.0,-1.0, 1.0) # Bottom Right Of The Quad (Front)
glColor3f(1.0,1.0,0.0) # Set The Color To Yellow
glVertex3f( 1.0,-1.0,-1.0) # Bottom Left Of The Quad (Back)
glVertex3f(-1.0,-1.0,-1.0) # Bottom Right Of The Quad (Back)
glVertex3f(-1.0, 1.0,-1.0) # Top Right Of The Quad (Back)
glVertex3f( 1.0, 1.0,-1.0) # Top Left Of The Quad (Back)
glColor3f(0.0,0.0,1.0) # Set The Color To Blue
glVertex3f(-1.0, 1.0, 1.0) # Top Right Of The Quad (Left)
glVertex3f(-1.0, 1.0,-1.0) # Top Left Of The Quad (Left)
glVertex3f(-1.0,-1.0,-1.0) # Bottom Left Of The Quad (Left)
glVertex3f(-1.0,-1.0, 1.0) # Bottom Right Of The Quad (Left)
glColor3f(1.0,0.0,1.0) # Set The Color To Violet
glVertex3f( 1.0, 1.0,-1.0) # Top Right Of The Quad (Right)
glVertex3f( 1.0, 1.0, 1.0) # Top Left Of The Quad (Right)
glVertex3f( 1.0,-1.0, 1.0) # Bottom Left Of The Quad (Right)
glVertex3f( 1.0,-1.0,-1.0) # Bottom Right Of The Quad (Right)
glEnd() # Done Drawing The Quad
# since this is double buffered, swap the buffers to display what just got drawn.
glutSwapBuffers()
# The function called whenever a key is pressed. Note the use of Python tuples to pass in: (key, x, y)
def keyPressed(*args):
# If escape is pressed, kill everything.
if args[0] == ESCAPE:
glutDestroyWindow(window)
sys.exit()
def main():
global window
glutInit(sys.argv)
# Select type of Display mode:
# Double buffer
# RGBA color
# Alpha components supported
# Depth buffer
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH)
# get a 640 x 480 window
glutInitWindowSize(640, 480)
# the window starts at the upper left corner of the screen
glutInitWindowPosition(0, 0)
# Okay, like the C version we retain the window id to use when closing, but for those of you new
# to Python (like myself), remember this assignment would make the variable local and not global
# if it weren't for the global declaration at the start of main.
window = glutCreateWindow("Jeff Molofee's GL Code Tutorial ... NeHe '99")
# Register the drawing function with glut, BUT in Python land, at least using PyOpenGL, we need to
# set the function pointer and invoke a function to actually register the callback, otherwise it
# would be very much like the C version of the code.
glutDisplayFunc(DrawGLScene)
#glutDisplayFunc()
# Uncomment this line to get full screen.
# glutFullScreen()
# When we are doing nothing, redraw the scene.
glutIdleFunc(DrawGLScene)
# Register the function called when our window is resized.
glutReshapeFunc(ReSizeGLScene)
# Register the function called when the keyboard is pressed.
glutKeyboardFunc(keyPressed)
# Initialize our window.
InitGL(640, 480)
# Print message to console, and kick off the main to get it rolling.
print "Hit ESC key to quit."
if __name__ == '__main__':
try:
GLU_VERSION_1_2
except:
print "Need GLU 1.2 to run this demo"
sys.exit(1)
main()
glutMainLoop()Martijn
Martijn Kragtwijk wrote: What struck me as odd is that the rotation values seem to be either exactly 0.0 or 1.0 or -1.0 when I have only one axis rotated, and something in between when more than one axis is non-zero. Is this normal?
This means that sqrt(Rx * Rx + Ry * Ry + Rz * Rz) will always be 1.3DxInput v1.0 API wrote:10. AngleAxis Object
The AngleAxis object provides a representation for orientation in 3D space using an angle and an axis. The rotation is specified by a normalized vector and an angle around the vector. The rotation is the right-hand rule.
Another point to note is that Rx*Angle is not an Euler angle and that
rot_x += Rx is mathematically incorrect.
I would suggest having a look at the xna sample as to how this is done correctly.
Markus
Hi,
I am also trying to use the Space Navigator in Python. Because I had some problems installing PythonGL (more GLUT was bailing out), I stripped Martijn's exapmple to a non GL Version.
However I now have the problem only getting zeros as result.
As I understand from this discussion it is because of a missing "message pump".
- What is a "message pump"
- how can I implement on in Python?
- why can`t we have a function just reading out the values?
I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.
Best regards,
Carsten
I am also trying to use the Space Navigator in Python. Because I had some problems installing PythonGL (more GLUT was bailing out), I stripped Martijn's exapmple to a non GL Version.
However I now have the problem only getting zeros as result.
As I understand from this discussion it is because of a missing "message pump".
- What is a "message pump"
- how can I implement on in Python?
- why can`t we have a function just reading out the values?
I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.
Best regards,
Carsten
Hi calli,
I'm not sure it applies here but a beta program of the solution for Blender and 3D mice started today. More information is available here.I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.
No thats not what I am for. I extended the Gameengine in Blender (realtime graphics) with some devices so far and want to do the same for the SN.ngomes wrote:Hi calli,I'm not sure it applies here but a beta program of the solution for Blender and 3D mice started today. More information is available here.I am trying to use the Spave Navigator in Blenders (blender.org) Gameengine via Python.
So I am for a solution to get the data in pure Python (as example) and then use it inside the realtime engine (runtime scripts). I am not sure I can work with threads inside these scripts....
Carsten
Hi calli,
Are you able, on your Python script, to process raw Windows messages? Like WM_ACTIVATE or WM_PAINT?
A "message pump" is what is generally called the Windows feature of transmitting "messages" between the system and applications.calli wrote:- What is a "message pump"
- how can I implement on in Python?
- why can`t we have a function just reading out the values?
Are you able, on your Python script, to process raw Windows messages? Like WM_ACTIVATE or WM_PAINT?
