예제 #1
0
void runCuda()
{
    // Map OpenGL buffer object for writing from CUDA on a single GPU
    // No data is moved (Win & Linux). When mapped to CUDA, OpenGL should not use this buffer

    float4 *dptr=NULL;
    float *dptrvert=NULL;
    cudaGLMapBufferObject((void**)&dptrvert, planetVBO);

    // execute the kernel
    cudaNBodyUpdateWrapper(DT);
#if VISUALIZE == 1
    cudaUpdateVBO(dptrvert, field_width, field_height);
#endif
    // unmap buffer object
    cudaGLUnmapBufferObject(planetVBO);
}
void runCuda()
{
    // Map OpenGL buffer object for writing from CUDA on a single GPU
    // No data is moved (Win & Linux). When mapped to CUDA, OpenGL should not use this buffer

    float *dptrvert=NULL;
	float *velptr=NULL;
    cudaGLMapBufferObject((void**)&dptrvert, planetVBO);
	cudaGLMapBufferObject((void**)&velptr, velocityVBO);

    // execute the kernel
    cudaFlockingUpdateWrapper(DT, seekTarget);
#if VISUALIZE == 1
    cudaUpdateVBO(dptrvert, velptr);
#endif
    // unmap buffer object
    cudaGLUnmapBufferObject(planetVBO);
	cudaGLUnmapBufferObject(velocityVBO);
}