src/ofxOpenVR.cpp
//--------------------------------------------------------------
// Purpose: Draw all of the controllers as X/Y/Z lines
//--------------------------------------------------------------
Draw all of the controllers as X/Y/Z lines
Draw all of the controllers as X / Y / Z lines
void ofxOpenVR::drawControllers()
{
	if (_pHMD->IsInputFocusCapturedByAnotherProcess()) {
		return;
	}
	_controllersVbo.clear();
	if (_pHMD->IsTrackedDeviceConnected(_leftControllerDeviceID)) {
		glm::vec4 center = _mat4LeftControllerPose * glm::vec4(0, 0, 0, 1);
		for (int i = 0; i < 3; ++i)
		{
			glm::vec3 color(0, 0, 0);
			glm::vec4 point(0, 0, 0, 1);
			point[i] += 0.05f;  
			color[i] = 1.0;  
			point = _mat4LeftControllerPose * point;
			_controllersVbo.addVertex(ofVec3f(center.x, center.y, center.z));
			_controllersVbo.addColor(ofFloatColor(color.x, color.y, color.z));
			_controllersVbo.addVertex(ofVec3f(point.x, point.y, point.z));
			_controllersVbo.addColor(ofFloatColor(color.x, color.y, color.z));
		}
	}
	if (_pHMD->IsTrackedDeviceConnected(_rightControllerDeviceID)) {
		glm::vec4 center = _mat4RightControllerPose * glm::vec4(0, 0, 0, 1);
		for (int i = 0; i < 3; ++i)
		{
			glm::vec3 color(0, 0, 0);
			glm::vec4 point(0, 0, 0, 1);
			point[i] += 0.05f;  
			color[i] = 1.0;  
			point = _mat4RightControllerPose * point;
			_controllersVbo.addVertex(ofVec3f(center.x, center.y, center.z));
			_controllersVbo.addColor(ofFloatColor(color.x, color.y, color.z));
			_controllersVbo.addVertex(ofVec3f(point.x, point.y, point.z));
			_controllersVbo.addColor(ofFloatColor(color.x, color.y, color.z));
		}
	}
}
void ofxOpenVR :: drawControllers ( ) { if ( _pHMD -> IsInputFocusCapturedByAnotherProcess ( ) ) { return ; } _controllersVbo . clear ( ) ; if ( _pHMD -> IsTrackedDeviceConnected ( _leftControllerDeviceID ) ) { glm :: vec4 center = _mat4LeftControllerPose * glm :: vec4 ( 0 , 0 , 0 , 1 ) ; for ( int i = 0 ; i < 3 ; ++ i ) { glm :: vec3 color ( 0 , 0 , 0 ) ; glm :: vec4 point ( 0 , 0 , 0 , 1 ) ; point [ i ] += 0.05f ; color [ i ] = 1.0 ; point = _mat4LeftControllerPose * point ; _controllersVbo . addVertex ( ofVec3f ( center . x , center . y , center . z ) ) ; _controllersVbo . addColor ( ofFloatColor ( color . x , color . y , color . z ) ) ; _controllersVbo . addVertex ( ofVec3f ( point . x , point . y , point . z ) ) ; _controllersVbo . addColor ( ofFloatColor ( color . x , color . y , color . z ) ) ; } } if ( _pHMD -> IsTrackedDeviceConnected ( _rightControllerDeviceID ) ) { glm :: vec4 center = _mat4RightControllerPose * glm :: vec4 ( 0 , 0 , 0 , 1 ) ; for ( int i = 0 ; i < 3 ; ++ i ) { glm :: vec3 color ( 0 , 0 , 0 ) ; glm :: vec4 point ( 0 , 0 , 0 , 1 ) ; point [ i ] += 0.05f ; color [ i ] = 1.0 ; point = _mat4RightControllerPose * point ; _controllersVbo . addVertex ( ofVec3f ( center . x , center . y , center . z ) ) ; _controllersVbo . addColor ( ofFloatColor ( color . x , color . y , color . z ) ) ; _controllersVbo . addVertex ( ofVec3f ( point . x , point . y , point . z ) ) ; _controllersVbo . addColor ( ofFloatColor ( color . x , color . y , color . z ) ) ; } } }
Purpose: Draw all of the controllers as X/Y/Z lines
Purpose : Draw all of the controllers as X / Y / Z lines
// Don't draw controllers if somebody else has input focus // Left controller // offset in X, Y, Z // R, G, B // Right controller // offset in X, Y, Z // R, G, B