Skip to content

Commit

Permalink
Warn if trying to set vertex attrib divisor on unsupported backend
Browse files Browse the repository at this point in the history
  • Loading branch information
aganders3 committed Apr 16, 2024
1 parent 6bc8d52 commit e27e089
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vispy/gloo/glir.py
Expand Up @@ -1283,7 +1283,13 @@ def _pre_draw(self):
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo_handle)
gl.glEnableVertexAttribArray(attr_handle)
func(attr_handle, *args)
gl.glVertexAttribDivisor(attr_handle, divisor or 0)
if hasattr(gl, "glVertexAttribDivisor"):
gl.glVertexAttribDivisor(attr_handle, divisor or 0)
elif divisor is not None:
logger.warning(
'Instanced rendering not supported by'
f'backend {gl.current_backend.__name__}'
)
else:
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, 0)
gl.glDisableVertexAttribArray(attr_handle)
Expand Down

0 comments on commit e27e089

Please sign in to comment.