[vtk-developers] OpenGL backend differences

Joachim Pouderoux joachim.pouderoux at kitware.com
Tue Apr 28 05:57:19 EDT 2015


Hi,

Mathieu and I were facing a tricky situation when adding a new VTK test.

We basically tried to render a piece of a RTAnalyticSource. We generated
the baseline image with the legacy backend and tests were failing with the
OpenGL 2 backend. Attached are the images we obtained with the two backends
- you can see that the color spots have not the same orientation.

We finally found the origin of the problem: as the grid is made of
hexahedron, the geometry filter generates a surface made of quads.
For the legacy backend, rendering quads is not an issue as OpenGL allows to
render (non-convex) polygons directly, so the legacy painter-mapper
directly sends the quad to OpenGL for rendering.
With the new backend, only triangles are transferred to the graphic board
and a triangulation is implicitly performed by the mapper (actually by
vtkglVBOHelper.cxx:338 - vtkgl::AppendTriangleIndexBuffer function). Note
that this function respects the order of the triangulation performed by
vtkQuad::Triangulate() but it seems like it is not the one implicitly
performed by OpenGL (or some OpenGL implementations at least) when you
render quad primitives.
To fix the issue we inserted a vtkTriangleFilter between the GeometryFilter
and the Mapper so that both mapper implementations end up with the same
triangulated mesh to render.

I think this behaviour should be documented somewhere (may be it is
already? anyway now at least it is here) as I am sure this should cause
problems later.

Best,

*Joachim Pouderoux*

*PhD, Technical Expert*
*Kitware SAS <http://www.kitware.fr>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150428/c8ebfb40/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-opengl1.png
Type: image/png
Size: 5514 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150428/c8ebfb40/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-opengl2.png
Type: image/png
Size: 5445 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150428/c8ebfb40/attachment-0003.png>


More information about the vtk-developers mailing list