tests/cuda4.1sdk/tests/simpleGL/simpleGL.cpp
void runCuda(struct cudaGraphicsResource **vbo_resource)
{
    // map OpenGL buffer object for writing from CUDA
    float4 *dptr;
    // DEPRECATED: cutilSafeCall(cudaGLMapBufferObject((void**)&dptr, vbo));
    cutilSafeCall(cudaGraphicsMapResources(1, vbo_resource, 0));
    size_t num_bytes; 
    cutilSafeCall(cudaGraphicsResourceGetMappedPointer((void **)&dptr, &num_bytes,  
						       *vbo_resource));
    //printf("CUDA mapped VBO: May access %ld bytes\n", num_bytes);

    // execute the kernel
    //    dim3 block(8, 8, 1);
    //    dim3 grid(mesh_width / block.x, mesh_height / block.y, 1);
    //    kernel<<< grid, block>>>(dptr, mesh_width, mesh_height, g_fAnim);

    launch_kernel(dptr, mesh_width, mesh_height, g_fAnim);

    // unmap buffer object
    // DEPRECATED: cutilSafeCall(cudaGLUnmapBufferObject(vbo));
    cutilSafeCall(cudaGraphicsUnmapResources(1, vbo_resource, 0));
}
////////////////////////////////////////////////////////////////////////////////
//! Run the Cuda part of the computation
////////////////////////////////////////////////////////////////////////////////
Run the Cuda part of the computation
Run the Cuda part of the computation
void runCuda(struct cudaGraphicsResource **vbo_resource)
{
    float4 *dptr;
    cutilSafeCall(cudaGraphicsMapResources(1, vbo_resource, 0));
    size_t num_bytes; 
    cutilSafeCall(cudaGraphicsResourceGetMappedPointer((void **)&dptr, &num_bytes,  
						       *vbo_resource));
    launch_kernel(dptr, mesh_width, mesh_height, g_fAnim);
    cutilSafeCall(cudaGraphicsUnmapResources(1, vbo_resource, 0));
}
void runCuda ( struct cudaGraphicsResource * * vbo_resource ) { float4 * dptr ; cutilSafeCall ( cudaGraphicsMapResources ( 1 , vbo_resource , 0 ) ) ; size_t num_bytes ; cutilSafeCall ( cudaGraphicsResourceGetMappedPointer ( ( void * * ) & dptr , & num_bytes , * vbo_resource ) ) ; launch_kernel ( dptr , mesh_width , mesh_height , g_fAnim ) ; cutilSafeCall ( cudaGraphicsUnmapResources ( 1 , vbo_resource , 0 ) ) ; }
Run the Cuda part of the computation
Run the Cuda part of the computation
// map OpenGL buffer object for writing from CUDA // DEPRECATED: cutilSafeCall(cudaGLMapBufferObject((void**)&dptr, vbo)); //printf("CUDA mapped VBO: May access %ld bytes\n", num_bytes); // execute the kernel //    dim3 block(8, 8, 1); //    dim3 grid(mesh_width / block.x, mesh_height / block.y, 1); //    kernel<<< grid, block>>>(dptr, mesh_width, mesh_height, g_fAnim); // unmap buffer object // DEPRECATED: cutilSafeCall(cudaGLUnmapBufferObject(vbo));