cancel
Showing results for 
Search instead for 
Did you mean: 

how to run DLL Project

ceeabdur09
Honored Guest
Dear all, I am civil engineer not a programmer but i have curious about VR project. I am trying to understand this three program such as dllmain.cpp , RiftWrapper.cpp, RiftWrapper.h but i could not run successfully that's why day day i feel hopeless ...... please help me

// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
//......................................................................................................................
// RiftWrapper.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"


#include "libovrwrapper.h"
#include <OVR.h>

using namespace OVR;

// Ptr<> AddRef'ed, AutoCleaned
bool bInited = false;
Ptr<DeviceManager> pManager;
Ptr<HMDDevice> pHMD;
Ptr<SensorDevice> pSensor;
SensorFusion pSensorFusion;


LIBOVRWRAPPER_API int OVR_Init()
{
bInited = false;
System::Init(Log::ConfigureDefaultLog(LogMask_Regular));

if (System::IsInitialized())
{
int stage = -1;
while (++stage > -1 && !bInited)
{
switch (stage)
{
case 0:
pManager = *DeviceManager::Create();
if (pManager == NULL)
return bInited;
break;
case 1:
pHMD = *pManager->EnumerateDevices<HMDDevice>().CreateDevice();
if (pHMD == NULL)
return bInited;
break;
case 2:
pSensor = *pHMD->GetSensor();
if (pSensor == NULL)
return bInited;
break;
default:
bInited = true;
break;
};
}
}

pSensorFusion.AttachToSensor(pSensor);

return (bInited?1:0);
}


LIBOVRWRAPPER_API void OVR_Exit()
{
if (bInited)
{
System::Destroy();
}
}


LIBOVRWRAPPER_API int OVR_QueryHMD(OVR_HMDInfo* refHmdInfo)
{
if (!bInited)
{
return 0;
}

HMDInfo src;
if (pHMD->GetDeviceInfo(&src))
{
refHmdInfo->HResolution = src.HResolution;
refHmdInfo->VResolution = src.VResolution;
refHmdInfo->HScreenSize = src.HScreenSize;
refHmdInfo->VScreenSize = src.VScreenSize;
refHmdInfo->VScreenCenter = src.VScreenCenter;
refHmdInfo->EyeToScreenDistance = src.EyeToScreenDistance;
refHmdInfo->LensSeparationDistance = src.LensSeparationDistance;
refHmdInfo->InterpupillaryDistance = src.InterpupillaryDistance;
refHmdInfo->DistortionK[0] = src.DistortionK[0];
refHmdInfo->DistortionK[1] = src.DistortionK[1];
refHmdInfo->DistortionK[2] = src.DistortionK[2];
refHmdInfo->DistortionK[3] = src.DistortionK[3];
refHmdInfo->DesktopX = src.DesktopX;
refHmdInfo->DesktopY = src.DesktopY;
memcpy(refHmdInfo->DisplayDeviceName, src.DisplayDeviceName, sizeof(refHmdInfo->DisplayDeviceName));
}

return 1;
}
LIBOVRWRAPPER_API int OVR_PeekYPL(float* yaw, float* pitch, float* roll)
{
if (!bInited)
{
return 0;
}

Quatf hmdOrient = pSensorFusion.GetOrientation();
hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(yaw, pitch, roll);

return 1;
}

LIBOVRWRAPPER_API int OVR_Peek(float* w, float* x, float* y,float * z)
{
if (!bInited)
{
return 0;
}

Quatf hmdOrient = pSensorFusion.GetOrientation();
*w = hmdOrient.w;
*x = hmdOrient.x;
*y = hmdOrient.y;
*z = hmdOrient.z;

//hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(yaw, pitch, roll);

return 1;
}
//..........................................................................................................................
#ifdef LIBOVRWRAPPER_EXPORTS
#if defined __cplusplus
#define LIBOVRWRAPPER_API extern "C" __declspec(dllexport)
#else
#define LIBOVRWRAPPER_API __declspec(dllexport)
#endif
#else
#if defined __cplusplus
#define LIBOVRWRAPPER_API extern "C" __declspec(dllimport)
#else
#define LIBOVRWRAPPER_API __declspec(dllimport)
#endif
#endif

struct OVR_HMDInfo
{
unsigned HResolution;
unsigned VResolution;
float HScreenSize;
float VScreenSize;
float VScreenCenter;
float EyeToScreenDistance;
float LensSeparationDistance;
float InterpupillaryDistance;
float DistortionK[4];
int DesktopX;
int DesktopY;
char DisplayDeviceName[32];
};


LIBOVRWRAPPER_API int OVR_Init();
LIBOVRWRAPPER_API void OVR_Exit();
LIBOVRWRAPPER_API int OVR_QueryHMD(struct OVR_HMDInfo* refHmdInfo);
LIBOVRWRAPPER_API int OVR_Peek(float* w, float* x, float* y,float * z);
LIBOVRWRAPPER_API int OVR_PeekYPL(float* yaw, float* pitch, float* roll);
3 REPLIES 3

ceeabdur09
Honored Guest
This is the Oculus SDK project. When this project run successfully, it views a HMD...........but i could't succesfully.
I want to run this type of program which encourage me a lot. Advanced thanks.

ceeabdur09
Honored Guest
How to run Oculus World Demo Programming by using Visual Studio Express 2012 for windows 32 bit

ceeabdur09
Honored Guest
Error 1 error C1083: Cannot open include file: 'OVR_Kernel.h': No such file or directory d:\c++\sdk\oculussdk\samples\oculusworlddemo\OculusWorldDemo.h 28 1 OculusWorldDemo