ohmd

package module
v0.0.0-...-4d56825 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2014 License: BSL-1.0 Imports: 2 Imported by: 0

README

ohmd - an OpenHMD wrapper for go

A quick example:

	c := ohmd.New()
	c.Probe()
	d, _ := c.ListOpenDevice(0)
	for {
		c.Update()
		q, _ := d.Getf(ohmd.ROTATION_QUAT)
		fmt.Printf("%v\n", q)
		time.Sleep(1 / 60 * time.Second)
	}

See the following locations for documentation:

	http://godoc.org/github.com/raggi/ohmd
	http://openhmd.net/

See ohmd_test.go for an Example:
	https://github.com/raggi/ohmd/blob/master/ohmd_test.go

Documentation

Index

Constants

View Source
const (
	VENDOR = C.ohmd_string_value(iota)
	PRODUCT
	PATH
)

String values for #Context.ListGets

View Source
const (
	// float64[4], get - Absolute rotation of the device, in space, as a quaternion.
	ROTATION_QUAT = C.ohmd_float_value(iota + 1)

	// float64[16], get - A "ready to use" OpenGL style 4x4 matrix with a modelview matrix for the left eye of the HMD.
	LEFT_EYE_GL_MODELVIEW_MATRIX

	// float64[16], get - A "ready to use" OpenGL style 4x4 matrix with a modelview matrix for the right eye of the HMD.
	RIGHT_EYE_GL_MODELVIEW_MATRIX

	// float64[16], get - A "ready to use" OpenGL style 4x4 matrix with a projection matrix for the left eye of the HMD.
	LEFT_EYE_GL_PROJECTION_MATRIX
	// float64[16], get - A "ready to use" OpenGL style 4x4 matrix with a projection matrix for the right eye of the HMD.
	RIGHT_EYE_GL_PROJECTION_MATRIX

	// float64[3], get - A 3-D vector representing the absolute position of the device, in space.
	POSITION_VECTOR

	// float64[1], get - Physical width of the device screen, in centimeters.
	SCREEN_HORIZONTAL_SIZE
	// float64[1], get - Physical height of the device screen, in centimeters.
	SCREEN_VERTICAL_SIZE

	// float64[1], get - Physical speration of the device lenses, in centimeters.
	LENS_HORIZONTAL_SEPARATION
	// float64[1], get - Physical vertical position of the lenses, in centimeters.
	LENS_VERTICAL_POSITION

	// float64[1], get - Physical field of view for the left eye, in degrees.
	LEFT_EYE_FOV
	// float64[1], get - Physical display aspect ratio for the left eye screen.
	LEFT_EYE_ASPECT_RATIO
	// float64[1], get - Physical field of view for the left right, in degrees.
	RIGHT_EYE_FOV
	// float64[1], get Physical display aspect ratio for the right eye screen.
	RIGHT_EYE_ASPECT_RATIO

	// float64[1], get/set - Physical interpupilary distance of the user, in centimeters.
	EYE_IPD

	// float64[1], get/set - Z-far value for the projection matrix calculations, i.e. drawing distance.
	PROJECTION_ZFAR
	// float64[1], get/set - Z-near value for the projection matrix calculations, i.e. close clipping distance.
	PROJECTION_ZNEAR

	// float64[6], get - Device specifc distortion value.
	DISTORTION_K
)

Float values for #Device.Getf

View Source
const (
	// int[1], get Physical horizontal resolution of the device screen.
	SCREEN_HORIZONTAL_RESOLUTION = C.ohmd_int_value(iota)
	// int[1], get Physical vertical resolution of the device screen.
	SCREEN_VERTICAL_RESOLUTION
)

int values for #Device.Geti

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

func Create

func Create() *Context

Create returns a new Context

func New

func New() *Context

Create for those that prefer common Go conventions

func (*Context) ListGets

func (c *Context) ListGets(idx int, t C.ohmd_string_value) (string, error)

ListGets fetches device information from the last probe, by idx.

func (*Context) ListOpenDevice

func (c *Context) ListOpenDevice(idx int) (*Device, error)

ListOpenDevice returns a new device pointer for the device given by idx.

func (*Context) Probe

func (c *Context) Probe() (int, error)

Probe searches for devices and returns the number found.

func (*Context) Update

func (c *Context) Update() error

Update refreshes all values in the context (and devices opened from the context). This performs background event pumping. Typically users would call this during rendering or animation frames.

type Device

type Device struct {
	// contains filtered or unexported fields
}

func (*Device) Getf

func (d *Device) Getf(t C.ohmd_float_value) ([]float64, error)

Getf queries the device for current floating point values for the given t. returns float64 instead of float32 for convenience with the math package.

func (*Device) Geti

func (d *Device) Geti(t C.ohmd_int_value) ([]int, error)

Geti queries the device for current integer values for the given t. returns a slice of integers. at time of writing this is always a single integer.

func (*Device) Setf

func (d *Device) Setf(t C.ohmd_float_value, v []float64) error

Setf sets floating point parameters on the device. See the float value constants for which fields may be set. The provided slice must contain at least the appropriate number of values to avoid segfault.

type Error

type Error string

func (Error) Error

func (e Error) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL