opengl-spacenavigator: Library and example for using a SpaceNavigator-compatible 3-D mouse with OpenGL

[ graphics, library, mit, program ] [ Propose Tags ] [ Report a vulnerability ]

This package contains functions for managing input from a SpaceNavigator <http://www.3dconnexion.com/products/spacemouse/spacenavigator.html>, or a 3D mouse compatible with its protocols. OpenGL callbacks are provided, along with utilities for quantizing the input from the mouse or tracking its six degrees of freedom.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.2.0, 0.1.4.2, 0.1.5.2, 0.1.5.4, 0.1.5.5
Dependencies base (>=4.8 && <5), binary (>=0.7.5), data-default (>=0.5.3), GLUT (>=2.7.0.1), OpenGL (>=2.12.0.1) [details]
License MIT
Copyright (c) 2015 Brian W Bush
Author Brian W Bush <consult@brianwbush.info>
Maintainer Brian W Bush <consult@brianwbush.info>
Category Graphics
Home page https://bitbucket.org/functionally/opengl-spacenavigator
Bug tracker https://bwbush.atlassian.net/projects/HOGLSPNV/issues/
Source repo head: git clone https://bitbucket.org/functionally/opengl-spacenavigator
Uploaded by BrianBush at 2016-04-16T18:14:01Z
Distributions NixOS:0.1.5.5
Reverse Dependencies 1 direct, 0 indirect [details]
Executables opengl-spacenavigator
Downloads 3079 total (18 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-04-16 [all 1 reports]

Readme for opengl-spacenavigator-0.1.5.5

[back to package description]

Functions for using SpaceNavigator-compatible 3D Mice with OpenGL

This Haskell package contains functions for managing input from a SpaceNavigator <http://www.3dconnexion.com/products/spacemouse/spacenavigator.html>, or a 3D mouse compatible with its protocols. OpenGL callbacks are provided, along with utilities for quantizing the input from the mouse or tracking its six degrees of freedom.

Please report issues at <https://bwbush.atlassian.net/projects/HOGLSPNV/issues/>.

Skeletal example illustrating the use of a SpaceNavigator with OpenGL

main :: IO ()
main = do
  _ <- getArgsAndInitialize
  initialDisplayMode $= [WithDepthBuffer, DoubleBuffered]
  _ <- createWindow "SpaceNavigator OpenGL Example"
  depthFunc $= Just Less 
  -- Create the tracker.
  tracking <- newIORef $ def {spaceNavigatorPosition = Vector3 0 0 0}
  -- Register a callback which quantizes and tracks the 3D mouse input.
  spaceNavigatorCallback $=! Just ( quantizeSpaceNavigator defaultQuantization $ trackSpaceNavigator defaultTracking tracking)
  -- The display callback needs the tracker.
  displayCallback $= display tracking
  idleCallback $= Just (postRedisplay Nothing)
  mainLoop

display :: IORef SpaceNavigatorTrack -> DisplayCallback
display tracking =
  do
    clear [ColorBuffer, DepthBuffer]
    loadIdentity
    -- Get the tracking state.
    tracking' <- get tracking
    -- Update the matrix based on the tracking
    doTracking tracking'
    -- All of the rendering actions go here.
    renderPrimitive . . . 
    swapBuffers

Notes on hardware and software

This code has been validated with the following configuration of hardware and software: