/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
| 585 | //! |
| 586 | //////////////////////////////////////////////////////////////////////////////// |
| 587 | void createTextureSrc(GLuint *tex_screen, unsigned int size_x, unsigned int size_y) |
| 588 | { |
| 589 | // create a texture |
| 590 | glGenTextures(1, tex_screen); |
| 591 | glBindTexture(GL_TEXTURE_2D, *tex_screen); |
| 592 | |
| 593 | // set basic parameters |
| 594 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 595 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 596 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 597 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
| 598 | |
| 599 | // buffer data |
| 600 | #ifndef USE_TEXTURE_RGBA8UI |
| 601 | printf("Creating a Texture render target GL_RGBA16F_ARB\n"); |
| 602 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F_ARB, size_x, size_y, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); |
| 603 | #else |
| 604 | printf("Creating a Texture render target GL_RGBA8UI_EXT\n"); |
| 605 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8UI_EXT, size_x, size_y, 0, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_BYTE, NULL); |
| 606 | #endif |
| 607 | SDK_CHECK_ERROR_GL(); |
| 608 | // register this texture with CUDA |
| 609 | checkCudaErrors(cudaGraphicsGLRegisterImage( |
| 610 | &cuda_tex_screen_resource, *tex_screen, GL_TEXTURE_2D, cudaGraphicsMapFlagsReadOnly)); |
| 611 | } |
| 612 | |
| 613 | //////////////////////////////////////////////////////////////////////////////// |
| 614 | //! |