render image using CUDA
| 121 | |
| 122 | // render image using CUDA |
| 123 | void render() |
| 124 | { |
| 125 | // map PBO to get CUDA device pointer |
| 126 | checkCudaErrors(cudaGraphicsMapResources(1, &cuda_pbo_resource, 0)); |
| 127 | size_t num_bytes; |
| 128 | checkCudaErrors(cudaGraphicsResourceGetMappedPointer((void **)&d_output, &num_bytes, cuda_pbo_resource)); |
| 129 | |
| 130 | // call CUDA kernel, writing results to PBO |
| 131 | renderAtlasImage(windowGridSize, windowBlockSize, d_output, windowSize.x, windowSize.y, lod); |
| 132 | |
| 133 | getLastCudaError("render_kernel failed"); |
| 134 | |
| 135 | checkCudaErrors(cudaGraphicsUnmapResources(1, &cuda_pbo_resource, 0)); |
| 136 | } |
| 137 | |
| 138 | // display results using OpenGL (called by GLUT) |
| 139 | void display() |