14 auto buffer = std::make_shared<PointCloudBuffer>(stride, num_points);
16 const auto error_check = [](cudaError_t error) {
17 if(error != cudaSuccess) {
23 cudaGraphicsResource* vbo_resource = 0;
24 error_check(cudaGraphicsGLRegisterBuffer(&vbo_resource, buffer->vbo_id(), cudaGraphicsRegisterFlagsNone));
26 float* dst_gl_ptr =
nullptr;
29 error_check(cudaGraphicsMapResources(1, &vbo_resource));
30 error_check(cudaGraphicsResourceGetMappedPointer((
void**)&dst_gl_ptr, &dst_size, vbo_resource));
32 error_check(cudaMemcpy(dst_gl_ptr, src_cuda_ptr, stride * num_points, cudaMemcpyDeviceToDevice));
34 error_check(cudaGraphicsUnmapResources(1, &vbo_resource));
35 error_check(cudaGraphicsUnregisterResource(vbo_resource));
static std::shared_ptr< PointCloudBuffer > create_point_cloud_buffer(const void *src_cuda_ptr, int stride, int num_points)
Definition pointcloud_buffer_cuda.hpp:13