Skip to content

Commit

Permalink
load ospray in a different way
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi Wu committed Apr 6, 2024
1 parent 654a81e commit 8e42aca
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions ovr/devices/ospray/device_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@ DeviceOSPRay::Impl::~Impl() {
ospUnmapFrameBuffer(framebuffer_rgba_ptr, ospray.framebuffer);
ospRelease(ospray.framebuffer);
}



ospShutdown();
}

Expand All @@ -415,38 +416,30 @@ DeviceOSPRay::Impl::init(int argc, const char** argv, DeviceOSPRay* p) {
}
else {
parent = p;

OSPError init_error = ospInit(&argc, argv);
if (init_error != OSP_NO_ERROR)
throw std::runtime_error("OSPRay not initialized correctly!");

#if 1
OSPDevice device = ospGetCurrentDevice();
// Initialize ospray device
ospLoadModule("cpu");
OSPDevice device = ospNewDevice("cpu");
if (!device)
throw std::runtime_error("OSPRay device could not be fetched!");

ospDeviceSetErrorCallback(
device,
ospDeviceSetErrorCallback(device,
[](void*, OSPError error, const char* what) {
std::cerr << "OSPRay error: " << what << std::endl;
std::runtime_error(std::string("OSPRay error: ") + what);
},
nullptr);
}, nullptr
);
ospDeviceSetStatusCallback(
device, [](void*, const char* msg) { std::cout << msg; }, nullptr);

bool warnAsErrors = true;
device, [](void*, const char* msg) { std::cout << msg; }, nullptr
);
auto warnAsErrors = true;
auto logLevel = OSP_LOG_WARNING;
ospDeviceSetParam(device, "warnAsError", OSP_BOOL, &warnAsErrors);
ospDeviceSetParam(device, "logLevel", OSP_INT, &logLevel);
ospDeviceCommit(device);
ospSetCurrentDevice(device);
ospDeviceRelease(device);
#endif

}

build_scene();

commit_framebuffer();
commit_renderer();
commit_camera();
Expand Down

0 comments on commit 8e42aca

Please sign in to comment.