code: def draw_visibility_image_internal(gl, v, f):
      
      gl.Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  
      fc = np.arange(1, len(f)+1)
      fc = np.tile(col(fc), (1, 3))
      fc[:, 0] = fc[:, 0] & 255
      fc[:, 1] = (fc[:, 1] >> 8 ) & 255
      fc[:, 2] = (fc[:, 2] >> 16 ) & 255
      fc = np.asarray(fc, dtype=np.uint8)
  
      draw_colored_primitives(gl, v, f, fc)
      raw = np.asarray(gl.getImage(), np.uint32)
      raw = raw[:,:,0] + raw[:,:,1]*256 + raw[:,:,2]*256*256 - 1
      return raw
docs: Assumes camera is set up correctly in gl context.