MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / createPBO

Function createPBO

cpp/5_Domain_Specific/postProcessGL/main.cpp:250–270  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// Create PBO ///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

248//! Create PBO
249////////////////////////////////////////////////////////////////////////////////
250void createPBO(GLuint *pbo, struct cudaGraphicsResource **pbo_resource)
251{
252 // set up vertex data parameter
253 num_texels = image_width * image_height;
254 num_values = num_texels * 4;
255 size_tex_data = sizeof(GLubyte) * num_values;
256 void *data = malloc(size_tex_data);
257
258 // create buffer object
259 glGenBuffers(1, pbo);
260 glBindBuffer(GL_ARRAY_BUFFER, *pbo);
261 glBufferData(GL_ARRAY_BUFFER, size_tex_data, data, GL_DYNAMIC_DRAW);
262 free(data);
263
264 glBindBuffer(GL_ARRAY_BUFFER, 0);
265
266 // register this buffer object with CUDA
267 checkCudaErrors(cudaGraphicsGLRegisterBuffer(pbo_resource, *pbo, cudaGraphicsMapFlagsNone));
268
269 SDK_CHECK_ERROR_GL();
270}
271
272void deletePBO(GLuint *pbo)
273{

Callers 1

initGLBuffersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected