libgoatvr

changeset 25:bb85be761b50

started the documentation
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 08 Mar 2015 05:30:02 +0200
parents d659cbedde1d
children 23a654109494 23a654109494
files README doc/1-init.rst doc/Makefile doc/index.rst
diffstat 4 files changed, 93 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/README	Wed Jan 14 08:03:27 2015 +0200
     1.2 +++ b/README	Sun Mar 08 05:30:02 2015 +0200
     1.3 @@ -6,10 +6,10 @@
     1.4  Libgoatvr is a simplified abstraction library for dealing with VR headsets. It
     1.5  is designed to expose a single common API to access VR HMDs through any of the
     1.6  supported backend modules, such as the Oculus SDK or OpenHMD, even allowing the
     1.7 -application to switch between them seamlessly at runtime.
     1.8 +application to switch between them at runtime.
     1.9  
    1.10  Currently implemented VR modules:
    1.11 - - Oculus SDK 0.4.1
    1.12 + - Oculus SDK 0.4.4
    1.13   - OpenHMD (not done)
    1.14   - null
    1.15  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/doc/1-init.rst	Sun Mar 08 05:30:02 2015 +0200
     2.3 @@ -0,0 +1,57 @@
     2.4 +Initialization
     2.5 +--------------
     2.6 +
     2.7 +Before calling any other function you need to initialize the VR library by
     2.8 +calling ``vr_init``. Similarly, ``vr_shutdown`` frees up all resources held by
     2.9 +the library.
    2.10 +
    2.11 +Libgoatvr has a number of backend modules for interfacing with VR headsets, and
    2.12 +there might be multiple modules compiled with your version of libgoatvr. If you
    2.13 +don't want to rely on the built-in defaults, you might want to enumerate and
    2.14 +select which module to use.
    2.15 +
    2.16 +The following example initializes the library, and prints the list of available
    2.17 +VR modules:
    2.18 +
    2.19 +.. code:: c
    2.20 +
    2.21 + #include <stdio.h>
    2.22 + #include <goatvr.h>
    2.23 + 
    2.24 + int main(void)
    2.25 + {
    2.26 + 	int i, nmod;
    2.27 + 
    2.28 + 	if(vr_init() == -1) {
    2.29 + 		fprintf(stderr, "failed to initialize goatvr\n");
    2.30 + 		return 1;
    2.31 + 	}
    2.32 + 
    2.33 + 	nmod = vr_module_count();
    2.34 + 	printf("There are %d modules:\n", nmod);
    2.35 + 	for(i=0; i<nmod; i++) {
    2.36 + 		printf(" %2d - %s\n", i, vr_module_name(i));
    2.37 + 	}
    2.38 + 	vr_shutdown();
    2.39 + 	return 0;
    2.40 + }
    2.41 + 
    2.42 +Running this on my computer, with the Oculus Rift DK2 connected, and oculusd
    2.43 +running, produces this output::
    2.44 +
    2.45 + initialized LibOVR 0.4.4
    2.46 + 1 Oculus HMD(s) found
    2.47 +  [0]: Oculus VR - Oculus Rift DK2
    2.48 + using vr module: libovr
    2.49 + There are 2 modules:
    2.50 +   0 - libovr
    2.51 +   1 - null
    2.52 +
    2.53 +The first four lines come from the initialization of the ``libovr`` module which
    2.54 +is selected by default if it's available. If however I turn off the DK2 or stop
    2.55 +the daemon, then I'm getting just the ``null`` module in this list.
    2.56 +
    2.57 +If you'd like to override the default selected module, and use the ``null``
    2.58 +module instead of ``libovr``, which is useful during development to avoid having
    2.59 +to put the HMD on and off all the time, you can call ``vr_use_module(1)``, or
    2.60 +``vr_use_module_named("null")``.
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/doc/Makefile	Sun Mar 08 05:30:02 2015 +0200
     3.3 @@ -0,0 +1,12 @@
     3.4 +rstfiles = $(wildcard *.rst)
     3.5 +htmlfiles = $(rstfiles:.rst=.html)
     3.6 +
     3.7 +.PHONY: html
     3.8 +html: $(htmlfiles)
     3.9 +
    3.10 +%.html: %.rst
    3.11 +	rst2html $(RSTFLAGS) $< >$@
    3.12 +
    3.13 +.PHONY: clean
    3.14 +clean:
    3.15 +	rm -f $(htmlfiles)
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/doc/index.rst	Sun Mar 08 05:30:02 2015 +0200
     4.3 @@ -0,0 +1,22 @@
     4.4 +libgoatvr
     4.5 +=========
     4.6 +
     4.7 +**This documentation is incomplete**
     4.8 +
     4.9 +Overview
    4.10 +--------
    4.11 +
    4.12 +Libgoatvr is a simplified abstraction library for dealing with VR headsets. It
    4.13 +is designed to expose a single common API to access VR HMDs through any of the
    4.14 +supported backend modules, such as the Oculus SDK or OpenHMD, even allowing the
    4.15 +application to switch between them at runtime.
    4.16 +
    4.17 +This documentation describes how to use libgoatvr in your programs, and is
    4.18 +split into the following sections:
    4.19 +
    4.20 + 1. Initialization_
    4.21 + 2. Head tracking
    4.22 + 3. Rendering
    4.23 + 4. options and properties
    4.24 +
    4.25 +.. _Initialization: 1-init.html