MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / createTextureDst

Function createTextureDst

cpp/5_Domain_Specific/postProcessGL/main.cpp:616–638  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

614//!
615////////////////////////////////////////////////////////////////////////////////
616void 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//!

Callers 1

initGLBuffersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected