/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
| 614 | //! |
| 615 | //////////////////////////////////////////////////////////////////////////////// |
| 616 | void createTextureDst(GLuint *tex_cudaResult, unsigned int size_x, unsigned int size_y) |
| 617 | { |
| 618 | // create a texture |
| 619 | glGenTextures(1, tex_cudaResult); |
| 620 | glBindTexture(GL_TEXTURE_2D, *tex_cudaResult); |
| 621 | |
| 622 | // set basic parameters |
| 623 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 624 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 625 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 626 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 627 | |
| 628 | #ifdef USE_TEXSUBIMAGE2D |
| 629 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, size_x, size_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
| 630 | SDK_CHECK_ERROR_GL(); |
| 631 | #else |
| 632 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8UI_EXT, size_x, size_y, 0, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_BYTE, NULL); |
| 633 | SDK_CHECK_ERROR_GL(); |
| 634 | // register this texture with CUDA |
| 635 | checkCudaErrors(cudaGraphicsGLRegisterImage( |
| 636 | &cuda_tex_result_resource, *tex_cudaResult, GL_TEXTURE_2D, cudaGraphicsMapFlagsWriteDiscard)); |
| 637 | #endif |
| 638 | } |
| 639 | |
| 640 | //////////////////////////////////////////////////////////////////////////////// |
| 641 | //! |