hello everyone, I am a stranger to cuda and I have a problem about transfer cuda to opengl, I downloaded the video codec sdk and test the sample code AppDecGL, and it works fine, but the code attach below I wroted got an error of CUDA_ERROR_OPERATING_SYSTEM when cuGraphicsGLRegisterBuffer invoked, I am so confused, may be the opengl version is not compatible? the opengl I use is opengl es 2.0 (angle libglesv2.dll), any help will be highly appreciated, thanks alot
GLuint pbo = 0;
glGenBuffers(1, &pbo );
if (pbo <= 0)
return;
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbo );
glBufferData(GL_PIXEL_UNPACK_BUFFER, nWidth * nHeight * 4, NULL, GL_STREAM_DRAW);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
do
{
CUcontext cuda_ctx;
CUdevice cuDevice = 0;
if (CUDA_SUCCESS != cuDeviceGet(&cuDevice, 0))
break;
if (CUDA_SUCCESS != cuCtxCreate_v2(&cuda_ctx, CU_CTX_SCHED_BLOCKING_SYNC, cuDevice))
break;
if (CUDA_SUCCESS != cuCtxSetCurrent(cuda_ctx))
break;
} while (0);
CUgraphicsResource cuResource;
auto err = cuGraphicsGLRegisterBuffer(&cuResource, pbo, CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD);