libgoatvr

diff src/vr.c @ 7:6896f9cf9621

- configure now emits config.status with the current confure invocation - now vr_init will heed the VR_MODULE env var for the name of the module to use - more stuff on the openhmd module
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 19 Sep 2014 15:16:51 +0300
parents e63cb28fc644
children 3d9ec6fe97d7
line diff
     1.1 --- a/src/vr.c	Fri Sep 19 05:30:20 2014 +0300
     1.2 +++ b/src/vr.c	Fri Sep 19 15:16:51 2014 +0300
     1.3 @@ -1,4 +1,5 @@
     1.4  #include <stdio.h>
     1.5 +#include <stdlib.h>
     1.6  #include <string.h>
     1.7  #include "opengl.h"
     1.8  #include "vr.h"
     1.9 @@ -31,6 +32,7 @@
    1.10  int vr_init(void)
    1.11  {
    1.12  	int i, nmodules;
    1.13 +	char *vrmod_env;
    1.14  
    1.15  	/* create the default options database */
    1.16  	if(!defopt && (defopt = create_options())) {
    1.17 @@ -50,15 +52,18 @@
    1.18  		if(m->init() != -1) {
    1.19  			/* add to the active modules array */
    1.20  			vr_activate_module(i);
    1.21 -			if(!vrm) {
    1.22 -				vr_use_module(0);
    1.23 -			}
    1.24  		}
    1.25  	}
    1.26  
    1.27 -	if(!vrm) {
    1.28 +	if(!vr_get_num_active_modules()) {
    1.29  		return -1;
    1.30  	}
    1.31 +
    1.32 +	if((vrmod_env = getenv("VR_MODULE"))) {
    1.33 +		vr_use_module_named(vrmod_env);
    1.34 +	} else {
    1.35 +		vr_use_module(0);
    1.36 +	}
    1.37  	return 0;
    1.38  }
    1.39