10-11-2013 01:16 AM
class OvrWrapper {
public:
SensorFusion fusion;
OvrWrapper() {
OVR::System::Init();
}
virtual ~OvrWrapper() {
OVR::System::Destroy();
}
void run() {
... do something here ...
}
}
int main(int argc, char ** argv) {
OvrWrapper foo; foo.run();
}
10-11-2013 02:09 AM
10-11-2013 02:42 AM
10-11-2013 02:52 AM
10-11-2013 05:11 AM
"StellaArtois" wrote:
I'm assuming we can just allocate it on the heap instead after OVR::System::Init() has been called; although I can't currently try this while at work.
10-11-2013 01:23 PM
10-22-2013 08:44 AM
10-25-2013 11:11 AM
"cybereality" wrote:
Sorry guys, I just updated the wiki tutorials.
Basically you just need to declare the SensorFusion object as a pointer, and then allocate it somewhere after your call to System::Init(). Not a huge change, but obviously it might break some apps based on the minimal tutorial.
// Initialization /////////
OVR::System::Init();
OVR::Ptr<OVR::DeviceManager> device_manager = *(OVR::DeviceManager::Create());
OVR::Ptr<OVR::HMDDevice> display = *(device_manager ->EnumerateDevices<OVR::HMDDevice>().CreateDevice());
OVR::Ptr<OVR::SensorDevice> sensor = *(display->GetSensor());
OVR::SensorFusion * sensor_result = new OVR::SensorFusion(sensor);
// Use ////////////////
// ...
// Cleanup ////////////
// delete sensor_result; // Not needed because "sensor" will delete it now
sensor.Clear();
display.Clear();
device_manager.Clear();
OVR::System::Destroy();
10-25-2013 12:05 PM
10-25-2013 12:48 PM
"nhoobler" wrote:
So just to be clear, is the proper behavior now to allocate a sensor result object on the heap, and then rely on the Sensor it's attached to to clean it up? i.e.
// delete sensor_result; // Not needed because "sensor" will delete it now
sensor.Clear();
I ask because I seem to be getting de-allocation related crashes if I delete the object myself.