# Using vtk libraries for writing in xml/vtk fileformat

**URL:** https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017
**Category:** Development
**Tags:** file-formats
**Created:** [June 18, 2021, 8:51am UTC](https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017 "2021-06-18T08:51:58Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sagues](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sagues](https://discourse.vtk.org/u/Sagues)
#### Post date: [June 18, 2021, 8:51am UTC](https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017/1 "2021-06-18T08:51:58Z")

</div>

I am interested in writing files of finite element meshes and results in vtk format. I have found information about it in Text Book Manual of VTK. However, I would like to know if there are libraries that allows to write these type of files or it is necessary to implement oneself.

Thank you

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [June 19, 2021, 7:48am UTC](https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017/2 "2021-06-19T07:48:11Z")

</div>

A good place to start is with the [vtk-examples](https://kitware.github.io/vtk-examples/site/) e,g [ReadUnknownTypeXMLFile](https://kitware.github.io/vtk-examples/site/Cxx/IO/ReadUnknownTypeXMLFile/) this may also help: [how to handle FEM data in VTK?](http://vtk.1045678.n5.nabble.com/how-to-handle-FEM-data-in-VTK-td1253575.html)

---

<div class="post-metadata">

### Author: ![Sagues](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sagues](https://discourse.vtk.org/u/Sagues)
#### Post date: [June 21, 2021, 8:43am UTC](https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017/3 "2021-06-21T08:43:29Z")

</div>

Thanks for your answer. When I try to build the project I have the following error/warning: " Could not find the VTK package with the following required components: RenderingContextOpenGL2."

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [June 21, 2021, 9:46am UTC](https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017/4 "2021-06-21T09:46:46Z")

</div>

Did you build VTK with OpenGL2 enabled?

---

<div class="post-metadata">

### Author: ![Sagues](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/a88e4f/32.png) [@Sagues](https://discourse.vtk.org/u/Sagues)
#### Post date: [June 21, 2021, 1:12pm UTC](https://discourse.vtk.org/t/using-vtk-libraries-for-writing-in-xml-vtk-fileformat/6017/5 "2021-06-21T13:12:53Z")

</div>

I’m sorry but I am beginning to use VTK and I didn’t know anything about RenderingContextOpenGL2. Is it possible to activate this option after VTK package is installed?
