/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
| 422 | //! |
| 423 | //////////////////////////////////////////////////////////////////////////////// |
| 424 | void createTextureDst(GLuint *tex_cudaResult, unsigned int size_x, unsigned int size_y) |
| 425 | { |
| 426 | // create a texture |
| 427 | glGenTextures(1, tex_cudaResult); |
| 428 | glBindTexture(GL_TEXTURE_2D, *tex_cudaResult); |
| 429 | |
| 430 | // set basic parameters |
| 431 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 432 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 433 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 434 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 435 | |
| 436 | #ifdef USE_TEXSUBIMAGE2D |
| 437 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, size_x, size_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
| 438 | SDK_CHECK_ERROR_GL(); |
| 439 | #else |
| 440 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8UI_EXT, size_x, size_y, 0, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_BYTE, NULL); |
| 441 | SDK_CHECK_ERROR_GL(); |
| 442 | // register this texture with CUDA |
| 443 | checkCudaErrors(cudaGraphicsGLRegisterImage( |
| 444 | &cuda_tex_result_resource, *tex_cudaResult, GL_TEXTURE_2D, cudaGraphicsMapFlagsWriteDiscard)); |
| 445 | #endif |
| 446 | } |
| 447 | |
| 448 | //////////////////////////////////////////////////////////////////////////////// |
| 449 | //! |