Skip to content
Snippets Groups Projects
Unverified Commit 5f61dad6 authored by Bernhard Fröhler's avatar Bernhard Fröhler
Browse files

Add OpenXR cone example

parent ab38c4f2
No related branches found
No related tags found
Loading
......@@ -182,6 +182,7 @@ If you are new to VTK then these [tutorials](#tutorial) will help to get you sta
[OpenVROrientedCylinder](/Cxx/GeometricObjects/OpenVROrientedCylinder) | Show an oriented cylinder in VR using OpenVR.
[OpenVRSphere](/Cxx/GeometricObjects/OpenVRSphere) | Show a sphere in VR using OpenVR.
[OpenVRTessellatedBoxSource](/Cxx/GeometricObjects/OpenVRTessellatedBoxSource) | Show a tesselated box in VR using OpenVR.
[OpenXRCone](/Cxx/GeometricObjects/OpenXRCone) | Show a cone in VR using OpenXR.
[PlaneSourceDemo](/Cxx/GeometricObjects/PlaneSourceDemo) | Display the instance variables that define a vtkPlaneSource.
[Planes](/Cxx/GeometricObjects/Planes) |
[PlanesIntersection](/Cxx/GeometricObjects/PlanesIntersection) |
......
......@@ -50,6 +50,7 @@ Requires_Module(OpenVROrientedArrow RenderingOpenVR)
Requires_Module(OpenVROrientedCylinder RenderingOpenVR)
Requires_Module(OpenVRSphere RenderingOpenVR)
Requires_Module(OpenVRTessellatedBoxSource RenderingOpenVR)
Requires_Module(OpenXRCone RenderingOpenXR)
Requires_Module(ParametricObjectsDemo cli11)
Requires_Module(ParametricObjectsDemo fmt)
......
#include <vtkActor.h>
#include <vtkConeSource.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkOpenXRRenderWindow.h>
#include <vtkOpenXRRenderWindowInteractor.h>
#include <vtkOpenXRRenderer.h>
#include <vtkPolyDataMapper.h>
int main(int argc, char* argv[])
{
// Create a cone along with a mapper and actor for it
vtkNew<vtkConeSource> coneSource;
coneSource->Update();
vtkNew<vtkNamedColors> colors;
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputConnection(coneSource->GetOutputPort());
vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
// Create OpenXR renderer, render window, and interactor
vtkNew<vtkOpenXRRenderer> renderer;
vtkNew<vtkOpenXRRenderWindow> renderWindow;
renderWindow->Initialize();
renderWindow->AddRenderer(renderer);
vtkNew<vtkOpenXRRenderWindowInteractor> renderWindowInteractor;
renderWindowInteractor->SetRenderWindow(renderWindow);
// Add the actors to the scene
renderer->AddActor(actor);
renderer->SetBackground(colors->GetColor3d("ForestGreen").GetData());
// Render and interact
renderWindow->Render();
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
### Description
This example demonstrates rendering of a Cone in OpenXR.
!!! note "WINDOWS USERS"
For the interactions to work, you have to copy the `.json` manifest files from the subfolder Rendering/OpenXR in VTK's source to the working directory in which the example is run!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment