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

Function createTextureDst

cpp/0_Introduction/simpleCUDA2GL/main.cpp:424–446  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

422//!
423////////////////////////////////////////////////////////////////////////////////
424void 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//!

Callers 1

initGLBuffersFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected