Required OpenGL extensions missing / code=304(cudaErrorOperatingSystem) "cudaGraphicsGLRegisterBuffer(...)"

When I try and run some of the samples in 5_Simulations (e.g. nbody or particles) I get the following error

Required OpenGL extensions missing.

I’m on Ubuntu 20.04 in WSL2, using VcXsrv and have done export DISPLAY=`grep -oP "(?<=nameserver ).+" /etc/resolv.conf`:0.0 and export LIBGL_ALWAYS_INDIRECT=1

Can someone provide further information about which extensions I need to install? (I’m not familiar with OpenGL)

The error originates the following function in e.g. particles.cpp, which is called by main() fairly early on.

// initialize OpenGL
void initGL(int *argc, char **argv)
{
    glutInit(argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
    glutInitWindowSize(width, height);
    glutCreateWindow("CUDA Particles");

    if (!isGLVersionSupported(2,0) ||
        !areGLExtensionsSupported("GL_ARB_multitexture GL_ARB_vertex_buffer_object"))
    {
        fprintf(stderr, "Required OpenGL extensions missing.");
        exit(EXIT_FAILURE);
    }

#if defined (WIN32)

    if (wglewIsSupported("WGL_EXT_swap_control"))
    {
        // disable vertical sync
        wglSwapIntervalEXT(0);
    }

#endif

    glEnable(GL_DEPTH_TEST);
    glClearColor(0.25, 0.25, 0.25, 1.0);

    glutReportErrors();
}
1 Like

UPDATE

If I untick native opengl when launching VcXsrv and do not export LIBGL_ALWAYS_INDIRECT=1 then I no longer see the Required OpenGL extensions missing. error.

… but running ./particles now crashes immediately after a CUDA Particles window opens with

CUDA error at particleSystem_cuda.cu:78 code=304(cudaErrorOperatingSystem) "cudaGraphicsGLRegisterBuffer(cuda_vbo_resource, vbo, cudaGraphicsMapFlagsNone)"

(however, running ./particles -benchmark runs normally. Similarly, I get the same error with ./nbody, but ./nbody -hostmem runs normally)

I am using a Quadro P1000 with the Quadro graphics driver v465.12 with CUDA toolkit v11.1 and on Windows build 20277.1

Same error has been reported previously on the samples github repo https://github.com/NVIDIA/cuda-samples/issues/28

1 Like