Forum Discussion
ckoeber
12 years agoHonored Guest
Reading Sensor data with GLM and OpenGL ...
Hello, So I have my application ported to the rift using the SDK and I can read sensor data fine. It's calculating the sensor data and converting it over to GLM that is giving me problems. I...
ckoeber
12 years agoHonored Guest
Thanks for the help. I guess my main problem is really theoretical; I am not exactly sure how to alter my working code for basic walk throughs to incorporate the rift,
Here is my working code that DOESN'T use the rift.
I want to maintain the control that a person has with the mouse against the camera so I am not sure how to incorporate the Rift's sensor data against that.
The CurrentCameraViewingSettings.Yaw and Pitch values are altered when the mouse is moved by the user and then slowly drops to zero.
I'd love to incorporate the position data as well.
I guess Math isn't my strong suite...
Here is my working code that DOESN'T use the rift.
I want to maintain the control that a person has with the mouse against the camera so I am not sure how to incorporate the Rift's sensor data against that.
The CurrentCameraViewingSettings.Yaw and Pitch values are altered when the mouse is moved by the user and then slowly drops to zero.
I'd love to incorporate the position data as well.
I guess Math isn't my strong suite...
void GlMaintenance::FastUpdateCamera() {
DirectionOfWhereCameraIsFacing = glm::normalize(CenterOfWhatIsBeingLookedAt - PositionOfEyesOfPerson);
switch (CurrentCameraMode) {
case (ModeOfCamera::ORTHOGONAL) :
break;
Projection = glm::ortho(CurrentOrthoParameters.LeftPlane, CurrentOrthoParameters.RightPlane,
CurrentOrthoParameters.BottomPlane, CurrentOrthoParameters.TopPlane);
case (ModeOfCamera::PERSPECTIVE) :
default:
CameraAxis = glm::cross(DirectionOfWhereCameraIsFacing, DirectionOfUpForPerson);
CameraQuatPitch = glm::angleAxis(CurrentCameraViewingSettings.Pitch, CameraAxis);
CameraQuatYaw = glm::angleAxis(CurrentCameraViewingSettings.Yaw, DirectionOfUpForPerson);
CameraQuatRoll = glm::angleAxis(CurrentCameraViewingSettings.Roll, CameraAxis);
CameraQuatBothPitchAndYaw = glm::cross(CameraQuatPitch, CameraQuatYaw);
CameraQuatBothPitchAndYaw = glm::normalize(CameraQuatBothPitchAndYaw);
DirectionOfWhereCameraIsFacing = glm::rotate(CameraQuatBothPitchAndYaw, DirectionOfWhereCameraIsFacing);
PositionOfEyesOfPerson += CameraPositionDelta;
CenterOfWhatIsBeingLookedAt = PositionOfEyesOfPerson + DirectionOfWhereCameraIsFacing * 1.0f;
if (CameraProcessingThreadStarted == true) {
CurrentCameraViewingSettings.Yaw *= 0.7999f;
CurrentCameraViewingSettings.Pitch *= 0.7999f;
CameraPositionDelta = CameraPositionDelta * 0.90f;
}
else
{
CurrentCameraViewingSettings.Yaw *= 0.5f;
CurrentCameraViewingSettings.Pitch *= 0.5f;
CameraPositionDelta = CameraPositionDelta * 0.8f;
}
break;
}
View = glm::lookAt(PositionOfEyesOfPerson, CenterOfWhatIsBeingLookedAt, DirectionOfUpForPerson);
ModelViewProjectionMatrix = Projection * View * Model;
ProjectionViewMatrix = Projection * View;
}
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device