> For the complete documentation index, see [llms.txt](https://lfdocs.lookingglassfactory.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lfdocs.lookingglassfactory.com/software/third-party-apps-and-tools/vtk.md).

# VTK (Visualization Toolkit)

## Overview

The Visualization Toolkit (VTK) is open source software for manipulating and displaying scientific data. It comes with state-of-the-art tools for 3D rendering, a suite of widgets for 3D interaction, and extensive 2D plotting capability. VTK is used by academicians for teaching and research; by government research institutions such as Los Alamos National Lab in the US or CINECA in Italy; and by many commercial firms who use VTK to build or extend products.

VTK is written in C++ and supports several different higher level language wrappers, including Python, Java and JavaScript. It is also the core engine for other tools like [Paraview](/software/third-party-apps-and-tools/paraview.md) and [Slicer 3D](/software/third-party-apps-and-tools/3d-slicer.md).

To learn more about VTK, visit [vtk.org](https://vtk.org/).

Looking Glass support has been added to the master branch of the [VTK source code](https://gitlab.kitware.com/vtk/vtk) as of Oct 1, 2020. To use VTK with Looking Glass support, you must build VTK from source.

## Prerequisites

If this is the first time setting up a Looking Glass, visit the [Getting Started page](http://learn.lookingglassfactory.com/onboarding) to make sure your display is set up correctly and ready to go.

This integration requires the following:

1. [HoloPlay Service](https://lookingglassfactory.com/software/holoplay-service) v1.1.3 or later. Use this [diagnostic tool](/software/looking-glass-bridge.md#test-your-setup) to check which version you have installed if unsure.
2. [HoloPlay Core SDK](/legacy/legacy-software/core-sdk.md)

## Getting Started

To use VTK with the Looking Glass, you have to enable the `VTK_MODULE_ENABLE_VTK_RenderingLookingGlass` flag in CMake when building.

In CMake:

1. Set `VTK_MODULE_ENABLE_VTK_RenderingLookingGlass` to ON
2. Edit `HoloPlayCore_INCLUDE_DIR` to point to header files directory `<your_path>/HoloPlayCoreSDK/HoloPlayCore/include`
3. Edit `HoloPlayCore_LIBRARY` to point to the dylib file of your corresponding platform library `<your_path>/HoloPlayCoreSDK/HoloPlayCore/dylib/<platform_specific>`
4. (Optional) If you would like to run the examples provided, turn on `BUILD_TESTING` too.

Build.

For more detailed instructions on how to build VTK, visit the [official VTK Wiki page](https://vtk.org/Wiki/VTK/Configure_and_Build).

## Usage

There are two different approaches to rendering in the Looking Glass. You can create an OS-specific Looking Glass render window and use it as you would a regular `vtkRenderWindow` (see `Testing/Cxx/TestDragon.cxx`). Alternatively, you can use the vtkLookingGlassPass as you would normally use a render pass in a renderer (see `Testing\Cxx\TestLookingGlassPass.cxx`).

If you have enabled `BUILD_TESTING` then you can run the following:

```bash
~/vtk-build $ cd bin
~/vtk-build/bin $ ./vtkLookingGlassCxxTests "TestDragon" -D ../ExternalData/Testing -I
```

This should create a window inside the Looking Glass display with graphics that produce a holographic image. (Note: you may need to drag terminal window inside Looking Glass before running the command)

## Troubleshooting

Make sure HoloPlay Service is running and can detect your device. See [this page](/software/looking-glass-bridge.md#test-your-setup) for more help.

## Support

For further VTK support, visit the [VTK Forum](https://discourse.vtk.org/).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lfdocs.lookingglassfactory.com/software/third-party-apps-and-tools/vtk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
