[vtk-developers] Factory issue for new VBO and VertexArray painters

Xabi Riobe xabivtk at gmail.com
Tue Mar 18 08:36:01 EDT 2014


Hi Marcus,

Thanks for your information.
I first found vtkAbstractObjectFactoryNewMacro, and did not notice
vtkObjectFactoryNewMacro
until a few hours ago, that suited best for this case.
But i didn't know about VTK_ALL_NEW_OBJECT_FACTORY, that's interesting to
support old versions.

I'm reworking my code in vtk style and push it to gerrit soon.

By any chance, have you an idea about my cmake warning?
my unit test does not use any image data, include file, or specific code
for png...



2014-03-18 13:06 GMT+01:00 Marcus D. Hanwell <marcus.hanwell at kitware.com>:

> Hi,
>
> On Thu, Mar 13, 2014 at 10:31 AM, Xabi Riobe <xabivtk at gmail.com> wrote:
> > Hi,
> > I have a set of painter classes using VBO (adapted from VTKEdge) and
> > VertexArrays that i'm willing to share via gerrit, but there is an issue
> i
> > would like to resolve before, in order to add the test class.
> >
> > Currently i use them with vtk 5.10.1, and i have a rendering factory to
> > instantiate them instead of vtkPolygonsPainter, vtkLinesPainter and
> > vtkTStripsPainter.
> >
> > but with vtk 6.1, the factory mechanism has changed and i can not manage
> to
> > make it work properly. So i first try to localy test my classes with the
> new
> > version by incorporating them directly in
> vtkRenderingOpenGLObjectFactory,
> > adding these lines in Rendering\OpenGL\CMakeLists.txt :
> >
> > list(APPEND vtk_module_overrides "vtkPolygonsPainter")
> > set(vtk_module_vtkPolygonsPainter_override
> > "vtkOpenGLVertexArrayPolygonsPainter")
> >
> > Runing my test in debug, i can see that the class is added in the
> factory,
> > but when the vtkChooserPainter creates the vtkPolygonsPainter, my own
> class
> > is not instantiated, nor it is if i directly call
> vtkPolygonsPainter::New()
> > in the test.
> >
> > Is there something else i am missing to use my class in a factory with
> vtk
> > 6.1?
> >
> Part of the VTK 6 changes involved moving from all VTK classes
> checking for overrides to only those designed to do so. If you look
> the vtkPolygonsPainter uses vtkStandardNewMacro in its implementation,
> if you want to override it using the factory mechanism then it should
> use vtkObjectFactoryNewMacro which will check the object factory
> before falling back to the actual class that was instantiated.
>
> There is also a compile time switch, VTK_ALL_NEW_OBJECT_FACTORY, which
> defaults to off and will force all classes to use the object factory
> (as was the default before VTK 6.
>
> Hope that makes things clearer.
>
> Marcus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140318/c40586ad/attachment-0002.html>


More information about the vtk-developers mailing list