[vtk-developers] vtkOpenGLVertexBufferObjectGroup

David Thompson david.thompson at kitware.com
Thu Aug 10 14:12:25 EDT 2017


Hi all (but esp. Ken and Alexis),

I'm working on a project to use VTK's mappers to render VTK-m data (already resident on the GPU but not necessarily exposed to OpenGL).

Recently the vtkOpenGLPolyDataMapper was refactored to keep VBOs in the new vtkOpenGLVertexBufferObjectGroup class. This makes using the shaders in the mapper difficult because the buffer-group uploads arrays to the VBOs (which we want to avoid because the arrays are already on the GPU) and creates VBOs (meaning there is no way to create subclass of vtkOpenGLVertexBufferObject that overrides Upload() or something similar).

Do you have any ideas about how we might change the buffer-object-group to allow zero-transfer VTK-m arrays to be handled without uploading them? Perhaps we could add a method to vtkOpenGLVertexBufferObject that visits all the arrays for each VBO it has created?

class vtkOpenGLVertexBufferObject
{
...
  void VisitAllVBOs(
    vtkOpenGLVertexBufferObjectCache* vtkNotUsed(cache),
    std::function<void(
      const std::string&,
      vtkOpenGLVertexBufferObject*,
      vtkDataArray*)> visitor)
  {
    for (arrayIter bi = this->UsedDataArrays.begin();
      bi != this->UsedDataArrays.end(); ++bi)
    {
      for (auto ai : bi->second)
      {
        visitor(bi->first, this->UsedVBOs[bi->first], ai);
      }
    }
  }
...
};

This would get us 90% of the way to VTKm-based mappers (subclasses of vtkOpenGLPolyDataMapper), since we could write a visitor and skip the BuildAllVBOs() call.

	Thanks,
	David


More information about the vtk-developers mailing list