OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling

Hi All,
Please help me in fixing below issue.

I am running the code on Windows VM

  • Windows: Windows Server 2016 Datacenter
  • GPU: Nvidia Tesla V100-PCIE-16GB

I am facing below error in python implementation:

OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling

Please find the stack trace below:
Traceback (most recent call last):

  File "E:\WorkArea\Services\Python\HMR\4D-Humans\src\testModel.py", line 45, in <module>
    smpls, trks, _next_id, t_rendered_ = HMRonFrame(frame, count, smpls, trks, _next_id, False)
  File "E:\WorkArea\Services\Python\HMR\4D-Humans\src\HMRModel.py", line 266, in HMRonFrame
    t_rendered_ = phalp_tracker.renderHMRdataOnFrame(frame, t_, tracks)
  File "e:\workarea\services\python\hmr\phalp\phalp\trackers\PHALP2.py", line 258, in renderHMRdataOnFrame
    t_rendered_, t_f_size = self.visualizer.render_video(visuals)
  File "e:\workarea\services\python\hmr\phalp\phalp\visualize\visualizer.py", line 389, in render_video
    rendered_image_final, valid_mask  = self.render_single_frame(
  File "e:\workarea\services\python\hmr\phalp\phalp\visualize\visualizer.py", line 80, in render_single_frame
    rgb_from_pred, validmask = self.render.visualize_all(pred_vertices.numpy(), pred_cam_t_bs.cpu().numpy(), color, image, use_image=use_image)
  File "e:\workarea\services\python\hmr\phalp\phalp\visualize\py_renderer.py", line 117, in visualize_all
    color = self.__call__(verts, focal_length=fl, baseColorFactors=baseColorFactors)
  File "e:\workarea\services\python\hmr\phalp\phalp\visualize\py_renderer.py", line 153, in __call__
    color, rend_depth = self.renderer.render(scene, flags=pyrender.RenderFlags.RGBA)
  File "E:\WorkArea\Services\Python\HMR\hmr_env\lib\site-packages\pyrender\offscreen.py", line 102, in render
    retval = self._renderer.render(scene, flags, seg_node_map)
  File "E:\WorkArea\Services\Python\HMR\hmr_env\lib\site-packages\pyrender\renderer.py", line 136, in render
    self._update_context(scene, flags)
  File "E:\WorkArea\Services\Python\HMR\hmr_env\lib\site-packages\pyrender\renderer.py", line 751, in _update_context
    p._add_to_context()
  File "E:\WorkArea\Services\Python\HMR\hmr_env\lib\site-packages\pyrender\primitive.py", line 324, in _add_to_context
    self._vaid = glGenVertexArrays(1)
  File "src\latebind.pyx", line 39, in OpenGL_accelerate.latebind.LateBind.__call__
  File "src\wrapper.pyx", line 311, in OpenGL_accelerate.wrapper.Wrapper.__call__
  File "E:\WorkArea\Services\Python\HMR\hmr_env\lib\site-packages\OpenGL\platform\baseplatform.py", line 442, in __call__
    raise error.NullFunctionError(
OpenGL.error.NullFunctionError: Attempt to call an undefined function glGenVertexArrays, check for bool(glGenVertexArrays) before calling

The VM presumably doesn’t have direct access to the video card, only to a virtualised card which likely only supports OpenGL 1.1. glGenVertexArrays requires OpenGL 3.0.

Refer to the documentation for the virtualisation software.

What GClements said. That or you haven’t properly created and bound a GL context for drawing. Details…:

From the above Python call stack paths, this apparently uses:

which uses:

Is glGenVertexArrays() the first GL function you’re calling? If so, it’s possible that a GL context wasn’t properly created and bound before you got to this point. Make sure you’re properly initializing your window system library (e.g. one of GLUT, GLFW, etc.). Some links on this: