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

Function createPBO

cpp/0_Introduction/simpleCUDA2GL/main.cpp:156–176  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

154//! Create PBO
155////////////////////////////////////////////////////////////////////////////////
156void createPBO(GLuint *pbo, struct cudaGraphicsResource **pbo_resource)
157{
158 // set up vertex data parameter
159 num_texels = image_width * image_height;
160 num_values = num_texels * 4;
161 size_tex_data = sizeof(GLubyte) * num_values;
162 void *data = malloc(size_tex_data);
163
164 // create buffer object
165 glGenBuffers(1, pbo);
166 glBindBuffer(GL_ARRAY_BUFFER, *pbo);
167 glBufferData(GL_ARRAY_BUFFER, size_tex_data, data, GL_DYNAMIC_DRAW);
168 free(data);
169
170 glBindBuffer(GL_ARRAY_BUFFER, 0);
171
172 // register this buffer object with CUDA
173 checkCudaErrors(cudaGraphicsGLRegisterBuffer(pbo_resource, *pbo, cudaGraphicsMapFlagsNone));
174
175 SDK_CHECK_ERROR_GL();
176}
177
178void deletePBO(GLuint *pbo)
179{

Callers 1

initGLBuffersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected