Commit 3539d151 authored by Robert Menzel's avatar Robert Menzel

Rift SDK 0.4 support, reduced warnings on VStudio, OculusRiftCamera needs work

parent fdf55ef4
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -15,14 +15,17 @@ ...@@ -15,14 +15,17 @@
#include <ACGL/ACGL.hh> #include <ACGL/ACGL.hh>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#if ACGL_RIFT_SDK_VERSION >= 32 #if ACGL_RIFT_SDK_VERSION >= 40
#include <OVR_CAPI.h> #include <OVR_CAPI.h>
//class GLFWWindow;
#include <ACGL/OpenGL/GL.hh>
#include <GLFW/glfw3.h>
namespace ACGL{ namespace ACGL{
namespace HardwareSupport{ namespace HardwareSupport{
bool initRiftSDK(); bool initRiftSDK();
void shutdownRiftSDK(); void shutdownRiftSDK();
...@@ -33,6 +36,19 @@ namespace HardwareSupport{ ...@@ -33,6 +36,19 @@ namespace HardwareSupport{
// SDK gives different sizes per eye, return the max to make things easier: // SDK gives different sizes per eye, return the max to make things easier:
glm::uvec2 getOptimalRenderSizePerEye(ovrHmd _hmd); glm::uvec2 getOptimalRenderSizePerEye(ovrHmd _hmd);
#ifdef ACGL_COMPILE_WITH_GLFW
// the Rift SDK need to know our window, this function hides the window system/OS specifics:
// it's limited to OpenGL / no multisampling back buffers, if more flexibility is needed,
// write your own similar function:
bool configureRendering(ovrHmd _hmd, ovrEyeRenderDesc _eyeRenderDesc[2], glm::uvec2 _renderTagetSize, GLFWwindow *_window);
#endif
// after calling this the warning might still be presented for a few more seconds:
// returns true if the warning is still displayed. Can be called multiple times.
bool deactivateHealthWarning(ovrHmd _hmd);
// used only for debugging:
void printOVRDistortionCaps(unsigned int _caps);
} }
} }
......
...@@ -38,7 +38,7 @@ public: ...@@ -38,7 +38,7 @@ public:
std::string getFileNamesPrintable() const; std::string getFileNamesPrintable() const;
//! the imported sources don't count the original file! //! the imported sources don't count the original file!
unsigned int getNumberOfImportedFiles() const { return mSourceFileNames.size()-1; } unsigned int getNumberOfImportedFiles() const { return (unsigned int) mSourceFileNames.size()-1; }
//! 0 == original file //! 0 == original file
std::string getFileName( unsigned int i ) const { return mSourceFileNames[i]; } std::string getFileName( unsigned int i ) const { return mSourceFileNames[i]; }
......
...@@ -224,7 +224,7 @@ public: ...@@ -224,7 +224,7 @@ public:
size = glm::uvec3(0); size = glm::uvec3(0);
} }
size.z = mColorAttachments.size(); size.z = (glm::uint) mColorAttachments.size();
return size; return size;
} }
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
...@@ -6,7 +6,15 @@ ...@@ -6,7 +6,15 @@
#include <ACGL/Utils/Log.hh> #include <ACGL/Utils/Log.hh>
#ifdef ACGL_USE_OCULUS_RIFT #ifdef ACGL_USE_OCULUS_RIFT
#if ACGL_RIFT_SDK_VERSION >= 32 #if ACGL_RIFT_SDK_VERSION >= 40
#ifdef ACGL_COMPILE_WITH_GLFW
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#endif
#include <OVR_CAPI_GL.h>
namespace ACGL{ namespace ACGL{
namespace HardwareSupport{ namespace HardwareSupport{
...@@ -20,6 +28,8 @@ namespace HardwareSupport{ ...@@ -20,6 +28,8 @@ namespace HardwareSupport{
bool initRiftSDK() bool initRiftSDK()
{ {
cout << "initRiftSDK()" << endl;
if (ACGL_RiftSDKInitialized) return true; // don't init twice if (ACGL_RiftSDKInitialized) return true; // don't init twice
ovrBool ok = ovr_Initialize(); ovrBool ok = ovr_Initialize();
...@@ -44,6 +54,8 @@ namespace HardwareSupport{ ...@@ -44,6 +54,8 @@ namespace HardwareSupport{
// _headTranslationTrackingIsAllowed = if true the Tracking of DK2 will get supported, if false even a DK2 will behave like a DK1 // _headTranslationTrackingIsAllowed = if true the Tracking of DK2 will get supported, if false even a DK2 will behave like a DK1
ovrHmd createRift(bool _headTrackingIsRequired, bool _headTranslationTrackingIsAllowed) ovrHmd createRift(bool _headTrackingIsRequired, bool _headTranslationTrackingIsAllowed)
{ {
cout << "createRift()" << endl;
if (!ACGL_RiftSDKInitialized) { if (!ACGL_RiftSDKInitialized) {
error() << "Rift SDK not initialized correctly - did you call/check initRiftSDK()?" << endl; error() << "Rift SDK not initialized correctly - did you call/check initRiftSDK()?" << endl;
} }
...@@ -63,28 +75,30 @@ namespace HardwareSupport{ ...@@ -63,28 +75,30 @@ namespace HardwareSupport{
mHmd = NULL; mHmd = NULL;
#endif #endif
//ovrHmd_SetEnabledCaps(mHmd, ovrHmdCap_NoMirrorToWindow);
return mHmd; return mHmd;
} }
ovrHmdDesc mHmdDesc;
ovrHmd_GetDesc(mHmd, &mHmdDesc);
// debug output: // debug output:
debug() << "Connected to: " << mHmdDesc.ProductName << endl; debug() << "Connected to: " << mHmd->ProductName << endl;
// start the tracking: // start the tracking:
// what the application supports: // what the application supports:
unsigned int supportedCaps = ovrSensorCap_Orientation | ovrSensorCap_YawCorrection | ovrHmdCap_LowPersistence | ovrHmdCap_LatencyTest | ovrHmdCap_DynamicPrediction; unsigned int supportedCaps = ovrTrackingCap_Orientation | ovrTrackingCap_MagYawCorrection | ovrTrackingCap_Position; // | ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction;
if (_headTranslationTrackingIsAllowed) supportedCaps |= ovrSensorCap_Position; if (_headTranslationTrackingIsAllowed) supportedCaps |= ovrTrackingCap_Position;
// what the device must deliver as a bare minimum: // what the device must deliver as a bare minimum:
unsigned int requiredCaps = 0; unsigned int requiredCaps = 0;
if (_headTrackingIsRequired) requiredCaps |= ovrSensorCap_Orientation; if (_headTrackingIsRequired) requiredCaps |= ovrTrackingCap_Orientation;
ovrBool ok = ovrHmd_StartSensor(mHmd, supportedCaps, requiredCaps);
ovrBool ok = ovrHmd_ConfigureTracking(mHmd, supportedCaps, requiredCaps);
if (!ok) { if (!ok) {
error() << "could not get connected to a Rift tracker - only rendering is supported" << endl; error() << "could not get connected to a Rift tracker - only rendering is supported" << endl;
} }
return mHmd; return mHmd;
} }
...@@ -97,19 +111,98 @@ namespace HardwareSupport{ ...@@ -97,19 +111,98 @@ namespace HardwareSupport{
glm::uvec2 getOptimalRenderSizePerEye(ovrHmd _hmd) glm::uvec2 getOptimalRenderSizePerEye(ovrHmd _hmd)
{ {
if (_hmd == NULL) return glm::uvec2(640, 800); if (_hmd == NULL) return glm::uvec2(640, 800);
ovrHmdDesc hmdDesc; ovrSizei optimalLeft = ovrHmd_GetFovTextureSize(_hmd, ovrEye_Left, _hmd->DefaultEyeFov[0], 1.0f);
ovrHmd_GetDesc(_hmd, &hmdDesc); ovrSizei optimalRight = ovrHmd_GetFovTextureSize(_hmd, ovrEye_Right, _hmd->DefaultEyeFov[1], 1.0f);
ovrSizei optimalLeft = ovrHmd_GetFovTextureSize(_hmd, ovrEye_Left, hmdDesc.DefaultEyeFov[0], 1.0f);
ovrSizei optimalRight = ovrHmd_GetFovTextureSize(_hmd, ovrEye_Right, hmdDesc.DefaultEyeFov[1], 1.0f);
debug() << "optimalLeft " << optimalLeft.w << " " << optimalLeft.h << endl; debug() << "optimalLeft " << optimalLeft.w << " " << optimalLeft.h << endl;
debug() << "optimalRight " << optimalRight.w << " " << optimalRight.h << endl; debug() << "optimalRight " << optimalRight.w << " " << optimalRight.h << endl;
debug() << "hmd: " << hmdDesc.ProductName << endl; debug() << "hmd: " << _hmd->ProductName << endl;
debug() << "hmd WindowsPos: " << hmdDesc.WindowsPos.x << " " << hmdDesc.WindowsPos.y << endl; debug() << "hmd WindowsPos: " << _hmd->WindowsPos.x << " " << _hmd->WindowsPos.y << endl;
return glm::uvec2(glm::max(optimalLeft.w, optimalRight.w), glm::max(optimalLeft.h, optimalRight.h)); return glm::uvec2(glm::max(optimalLeft.w, optimalRight.w), glm::max(optimalLeft.h, optimalRight.h));
//return glm::uvec2(960, 1200);
} }
#ifdef ACGL_COMPILE_WITH_GLFW
bool configureRendering( ovrHmd _hmd, ovrEyeRenderDesc _eyeRenderDesc[2], glm::uvec2 _renderTagetSize, GLFWwindow *_window )
{
glBindVertexArray(0);
// Update ovr Rendering configuration
ovrGLConfig cfg;
cfg.OGL.Header.API = ovrRenderAPI_OpenGL;
cfg.OGL.Header.RTSize.w = _renderTagetSize.x;
cfg.OGL.Header.RTSize.h = _renderTagetSize.y;
cfg.OGL.Header.Multisample = 0;
#ifdef OVR_OS_WIN32
debug() << "configure Windows specifics" << std::endl;
cfg.OGL.Window = glfwGetWin32Window( _window );
cfg.OGL.DC = GetDC(cfg.OGL.Window);
#endif
#ifdef OVR_OS_MAC
debug() << "configure Mac specifics: TODO" << std::endl;
#endif
#ifdef OVR_OS_LINUX
debug() << "configure Linux specifics: TODO" << std::endl;
#endif
debug() << "call ovrHmd_ConfigureRendering():" << std::endl;
printOVRDistortionCaps(_hmd->DistortionCaps);
unsigned int distortionCaps = _hmd->DistortionCaps ^ ovrDistortionCap_FlipInput; // don't flip the input
//distortionCaps ^= ovrDistortionCap_NoRestore;
distortionCaps ^= ovrDistortionCap_SRGB;
printOVRDistortionCaps(distortionCaps);
ovrBool ok = ovrHmd_ConfigureRendering(_hmd, (ovrRenderAPIConfig*)&cfg, distortionCaps, _hmd->DefaultEyeFov, _eyeRenderDesc);
if (ok) {
bool riftIsUsingExtendedDesktop = (bool)(_hmd->HmdCaps & ovrHmdCap_ExtendDesktop);
if (riftIsUsingExtendedDesktop) {
debug() << "rendering on extended desktop" << endl;
} else {
debug() << "rendering in direct rendering mode" << endl;
ovrHmd_AttachToWindow(_hmd, cfg.OGL.Window, nullptr, nullptr);
}
debug() << "OVR Rendering configured" << std::endl;
}
else {
error() << "OVR Rendering failed to get configured" << std::endl;
}
return (bool)ok;
}
#endif
bool deactivateHealthWarning(ovrHmd _hmd)
{
ovrHSWDisplayState displayState;
ovrHmd_GetHSWDisplayState(_hmd, &displayState);
if (displayState.Displayed) {
ovrHmd_DismissHSWDisplay(_hmd);
return true;
}
return false;
}
// prints the distortion caps for debugging:
void printOVRDistortionCaps(unsigned int _caps) {
debug() << endl << "Distortion caps: " << _caps << " = ";
if (_caps & ovrDistortionCap_Chromatic) debug() << "Chromatic ";
if (_caps & ovrDistortionCap_TimeWarp) debug() << "TimeWarp ";
if (_caps & ovrDistortionCap_Vignette) debug() << "Vignette ";
if (_caps & ovrDistortionCap_NoRestore) debug() << "GLStateChangedBySDK ";
if (_caps & ovrDistortionCap_FlipInput) debug() << "FlipInput ";
if (_caps & ovrDistortionCap_SRGB) debug() << "sRGB_Input ";
if (_caps & ovrDistortionCap_Overdrive) debug() << "reduceDK2Artefacts ";
debug() << endl << endl;
}
} }
} }
......
...@@ -74,7 +74,7 @@ std::string ShaderParser::getFileNamesPrintable() const ...@@ -74,7 +74,7 @@ std::string ShaderParser::getFileNamesPrintable() const
{ {
std::string rString; std::string rString;
for (size_t i = 0; i < mSourceFileNames.size(); ++i) { for (size_t i = 0; i < mSourceFileNames.size(); ++i) {
rString += " " + StringHelpers::toString<unsigned int>(i+1) + " " + mSourceFileNames[i] + "\n"; rString += " " + StringHelpers::toString<unsigned int>( (unsigned int)i+1) + " " + mSourceFileNames[i] + "\n";
} }
return rString; return rString;
} }
...@@ -105,7 +105,7 @@ void ShaderParser::parse(const std::string &_filename) ...@@ -105,7 +105,7 @@ void ShaderParser::parse(const std::string &_filename)
int ShaderParser::registerSourceFile(const std::string &_name) int ShaderParser::registerSourceFile(const std::string &_name)
{ {
mSourceFileNames.push_back(_name); mSourceFileNames.push_back(_name);
return mSourceFileNames.size(); return (int) mSourceFileNames.size();
} }
void ShaderParser::addSource(const std::string &_source) void ShaderParser::addSource(const std::string &_source)
......
...@@ -15,7 +15,7 @@ GLsizei TextureData::getPackAlignment() const ...@@ -15,7 +15,7 @@ GLsizei TextureData::getPackAlignment() const
size_t dataAlignment = Utils::pointerAlignment( mData ); size_t dataAlignment = Utils::pointerAlignment( mData );
size_t rowAlignment = Utils::pointerAlignment( mData + getBytesPerScanline() ); size_t rowAlignment = Utils::pointerAlignment( mData + getBytesPerScanline() );
return std::min( dataAlignment, rowAlignment ); //minimum of the data and the begining of the second row return (GLsizei) std::min(dataAlignment, rowAlignment); //minimum of the data and the begining of the second row
} }
......
...@@ -215,7 +215,7 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st ...@@ -215,7 +215,7 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st
std::ofstream file(_filename.c_str(), std::ios_base::out | std::ios_base::binary); std::ofstream file(_filename.c_str(), std::ios_base::out | std::ios_base::binary);
// Header Section // Header Section
uint32_t numABs = usedArrayBuffers.size(); uint32_t numABs = (uint32_t) usedArrayBuffers.size();
uint32_t numEABs = _vao->getElementArrayBuffer() ? 1 : 0; uint32_t numEABs = _vao->getElementArrayBuffer() ? 1 : 0;
GLenum defaultMode = _vao->getMode(); GLenum defaultMode = _vao->getMode();
...@@ -243,9 +243,9 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st ...@@ -243,9 +243,9 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st
} }
std::string abName = ""; std::string abName = "";
uint32_t abNameLength = abName.size() + 1; // Counting the trailing '\0' uint32_t abNameLength = (uint32_t) abName.size() + 1; // Counting the trailing '\0'
GLsizei abStride = ab->getStride(); GLsizei abStride = ab->getStride();
uint32_t abNumAttributes = attributeIDs.size(); uint32_t abNumAttributes = (uint32_t) attributeIDs.size();
file.write((char*)&abNameLength, 4); file.write((char*)&abNameLength, 4);
writeString(file, abName); writeString(file, abName);
...@@ -260,7 +260,7 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st ...@@ -260,7 +260,7 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st
int32_t attrID = *attrIDIt; int32_t attrID = *attrIDIt;
std::string attrName = ab->getAttribute(attrID).name; std::string attrName = ab->getAttribute(attrID).name;
uint32_t attrNameLength = attrName.size() + 1; // Counting the trailing '\0' uint32_t attrNameLength = (uint32_t) attrName.size() + 1; // Counting the trailing '\0'
GLenum attrType = ab->getAttribute(attrID).type; GLenum attrType = ab->getAttribute(attrID).type;
GLint attrSize = ab->getAttribute(attrID).size; GLint attrSize = ab->getAttribute(attrID).size;
GLuint attrOffset = ab->getAttribute(attrID).offset; GLuint attrOffset = ab->getAttribute(attrID).offset;
...@@ -294,7 +294,7 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st ...@@ -294,7 +294,7 @@ bool saveVertexArrayObjectToVAO(ConstSharedVertexArrayObject _vao, const std::st
const ConstSharedElementArrayBuffer& eab = _vao->getElementArrayBuffer(); const ConstSharedElementArrayBuffer& eab = _vao->getElementArrayBuffer();
std::string eabName = ""; std::string eabName = "";
uint32_t eabNameLength = eabName.size() + 1; // Counting the trailing '\0' uint32_t eabNameLength = (uint32_t) eabName.size() + 1; // Counting the trailing '\0'
GLenum eabMode = _vao->getMode(); GLenum eabMode = _vao->getMode();
GLenum eabType = eab->getType(); GLenum eabType = eab->getType();
bool eabPR = false; // TODO: implement Primitive Reset bool eabPR = false; // TODO: implement Primitive Reset
......
...@@ -97,7 +97,7 @@ bool Shader::setSource(const std::string& _source, bool _checkForCompileErrors) ...@@ -97,7 +97,7 @@ bool Shader::setSource(const std::string& _source, bool _checkForCompileErrors)
bool Shader::setSources(const std::vector<std::string> &_sources, bool _checkForCompileErrors ) bool Shader::setSources(const std::vector<std::string> &_sources, bool _checkForCompileErrors )
{ {
unsigned int numberOfStrings = _sources.size(); unsigned int numberOfStrings = (unsigned int) _sources.size();
const char **pProgramStrings = new const char*[ numberOfStrings ]; const char **pProgramStrings = new const char*[ numberOfStrings ];
for (unsigned int i = 0; i < numberOfStrings; ++i) { for (unsigned int i = 0; i < numberOfStrings; ++i) {
......
...@@ -149,7 +149,8 @@ void TextureBase::generateMipmaps(void) ...@@ -149,7 +149,8 @@ void TextureBase::generateMipmaps(void)
// on some ATI systems texturing has to be enabled to generate MipMaps // on some ATI systems texturing has to be enabled to generate MipMaps
// this is not needed by the spec and deprecated on core profiles (generates // this is not needed by the spec and deprecated on core profiles (generates
// an error on MacOS X Lion) // an error on MacOS X Lion)
glEnable(mTarget); //glEnable(mTarget);
//glGetError(); // ignore the error
#endif #endif
#ifdef ACGL_OPENGL_VERSION_21 #ifdef ACGL_OPENGL_VERSION_21
// OpenGL 2 way to generate MipMaps // OpenGL 2 way to generate MipMaps
......
...@@ -155,7 +155,7 @@ void VertexArrayObject::detachAttribute( const std::string &_name ) ...@@ -155,7 +155,7 @@ void VertexArrayObject::detachAttribute( const std::string &_name )
{ {
if (mAttributes[i].arrayBuffer->getAttributes()[ mAttributes[i].attributeID ].name == _name) if (mAttributes[i].arrayBuffer->getAttributes()[ mAttributes[i].attributeID ].name == _name)
{ {
detachAttribute( i ); detachAttribute( (GLuint) i );
// the other pointer data is still set, but that isn't relevant if the attribute itself is deactivated // the other pointer data is still set, but that isn't relevant if the attribute itself is deactivated
//glDisableVertexArrayAttribEXT( mObjectName, mAttributes[i].location ); //glDisableVertexArrayAttribEXT( mObjectName, mAttributes[i].location );
//mAttributes.erase( mAttributes.begin()+i ); //mAttributes.erase( mAttributes.begin()+i );
...@@ -170,7 +170,7 @@ void VertexArrayObject::detachAllAttributes() ...@@ -170,7 +170,7 @@ void VertexArrayObject::detachAllAttributes()
{ {
for(AttributeVec::size_type i = 0; i < mAttributes.size(); ++i) for(AttributeVec::size_type i = 0; i < mAttributes.size(); ++i)
{ {
detachAttribute(i); detachAttribute( (GLuint) i );
} }
} }
...@@ -231,7 +231,7 @@ SharedLocationMappings VertexArrayObject::getAttributeLocations() const ...@@ -231,7 +231,7 @@ SharedLocationMappings VertexArrayObject::getAttributeLocations() const
{ {
if ( mAttributes[i].arrayBuffer ) { if ( mAttributes[i].arrayBuffer ) {
//debug() << "aloc: " << mAttributes[i].arrayBuffer->getAttribute( (int) mAttributes[i].attributeID ).name << " " << i << std::endl; //debug() << "aloc: " << mAttributes[i].arrayBuffer->getAttribute( (int) mAttributes[i].attributeID ).name << " " << i << std::endl;
locationMap->setLocation( mAttributes[i].arrayBuffer->getAttribute( (int) mAttributes[i].attributeID ).name, i ); locationMap->setLocation(mAttributes[i].arrayBuffer->getAttribute((int)mAttributes[i].attributeID).name, (GLuint) i);
} }
} }
......
...@@ -51,9 +51,8 @@ static glm::mat4 ovr2glm(const ovrMatrix4f& _matrix) ...@@ -51,9 +51,8 @@ static glm::mat4 ovr2glm(const ovrMatrix4f& _matrix)
void OculusRiftCamera::connectWithRift(ovrHmd _hmd) void OculusRiftCamera::connectWithRift(ovrHmd _hmd)
{ {
mHmd = _hmd; mHmd = _hmd;
ovrHmdDesc hmdDesc;
ovrHmd_GetDesc(_hmd, &hmdDesc);
mActiveEye = 0; mActiveEye = 0;
// both eyes are equal, // both eyes are equal,
...@@ -69,8 +68,8 @@ void OculusRiftCamera::connectWithRift(ovrHmd _hmd) ...@@ -69,8 +68,8 @@ void OculusRiftCamera::connectWithRift(ovrHmd _hmd)
for (int i = 0; i < 2; ++i) { for (int i = 0; i < 2; ++i) {
// for all eyes: // for all eyes:
mEyeDescription[i].Eye = hmdDesc.EyeRenderOrder[i]; mEyeDescription[i].Eye = _hmd->EyeRenderOrder[i];
mEyeDescription[i].Fov = hmdDesc.DefaultEyeFov[i]; mEyeDescription[i].Fov = _hmd->DefaultEyeFov[i];
mEyeDescription[i].TextureSize = ovrRenderTargetSizeForOneEye; mEyeDescription[i].TextureSize = ovrRenderTargetSizeForOneEye;
mEyeDescription[i].RenderViewport = perEyeViewport; mEyeDescription[i].RenderViewport = perEyeViewport;
...@@ -82,29 +81,33 @@ void OculusRiftCamera::connectWithRift(ovrHmd _hmd) ...@@ -82,29 +81,33 @@ void OculusRiftCamera::connectWithRift(ovrHmd _hmd)
mEyeOrdering[i] = GenericCamera::Eye::EYE_RIGHT; mEyeOrdering[i] = GenericCamera::Eye::EYE_RIGHT;
} }
} }
} }
GenericCamera::Eye OculusRiftCamera::startRenderingEye(int _eyeNumber) GenericCamera::Eye OculusRiftCamera::startRenderingEye(int _eyeNumber)
{ {
/*
mPoseUsedForRendering[_eyeNumber] = ovrHmd_BeginEyeRender(mHmd, mEyeDescription[_eyeNumber].Eye); mPoseUsedForRendering[_eyeNumber] = ovrHmd_BeginEyeRender(mHmd, mEyeDescription[_eyeNumber].Eye);
setEye(mEyeOrdering[_eyeNumber]); setEye(mEyeOrdering[_eyeNumber]);
mActiveEye = _eyeNumber; mActiveEye = _eyeNumber;
/*debug() << "Render Eye " << mActiveEye << ": " debug() << "Render Eye " << mActiveEye << ": "
<< mPoseUsedForRendering[_eyeNumber].Orientation.w << " " << mPoseUsedForRendering[_eyeNumber].Orientation.w << " "
<< mPoseUsedForRendering[_eyeNumber].Orientation.x << " " << mPoseUsedForRendering[_eyeNumber].Orientation.x << " "
<< mPoseUsedForRendering[_eyeNumber].Orientation.y << " " << mPoseUsedForRendering[_eyeNumber].Orientation.y << " "
<< mPoseUsedForRendering[_eyeNumber].Orientation.z << endl;*/ << mPoseUsedForRendering[_eyeNumber].Orientation.z << endl;
updateFromRift(); updateFromRift();
return mEyeOrdering[_eyeNumber]; return mEyeOrdering[_eyeNumber];
*/
return GenericCamera::Eye::EYE_LEFT;
} }
void OculusRiftCamera::stopRenderingEye(int _eyeNumber, ovrTexture* eyeTexture) void OculusRiftCamera::stopRenderingEye(int _eyeNumber, ovrTexture* eyeTexture)
{ {
ovrHmd_EndEyeRender(mHmd, mEyeDescription[_eyeNumber].Eye, mPoseUsedForRendering[_eyeNumber], eyeTexture); //ovrHmd_EndEyeRender(mHmd, mEyeDescription[_eyeNumber].Eye, mPoseUsedForRendering[_eyeNumber], eyeTexture);
} }
void OculusRiftCamera::updateFromRift() void OculusRiftCamera::updateFromRift()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment