[vtk-developers] OpenVR HTC Vive

Carlos Lopez rcourant at gmail.com
Thu Jun 22 18:25:57 EDT 2017


There are 2 factory options (at least) in VTK's cmake. With both of them
active, the example you mentioned (http://www.vtk.org/Wiki/VTK/Examples/Cxx/
GeometricObjects/Cylinder) works for me by only replacing the renderer,
render window and interactor classes with their openVR counterparts.



On Thu, Jun 22, 2017 at 3:31 PM, Ricardo <ricardo_morello at hotmail.com>
wrote:

> Carlos, thanks for the answer!
> I also forgot to mention that i reduced the cylinder's radius and height to
> 0.1, so it should not be inside the cylinder. I adjusted the tracking and
> now there are no more blue lines, just the blue circle the HTC compositor
> places. However, the cylinder is still not rendering in the scene. Here is
> the example with OpenVR classes:
>
> #include "stdafx.h"
> #include <vtkCylinderSource.h>
> #include <vtkPolyData.h>
> #include <vtkSmartPointer.h>
> #include <vtkPolyDataMapper.h>
> #include <vtkActor.h>
> #include <vtkOpenVRRenderWindow.h>
> #include <vtkOpenVRRenderer.h>
> #include <vtkOpenVRRenderWindowInteractor.h>
> #include <vtkOpenVRCamera.h>
> #include "vtkAutoInit.h"
> VTK_MODULE_INIT(vtkRenderingOpenGL2);
> VTK_MODULE_INIT(vtkInteractionStyle);
>
> int main(int, char *argv[])
> {
>         // Create a sphere
>         vtkSmartPointer<vtkCylinderSource> cylinderSource =
>                 vtkSmartPointer<vtkCylinderSource>::New();
>         cylinderSource->SetCenter(0.0, 0.0, 0.0);
>         cylinderSource->SetRadius(0.1);
>         cylinderSource->SetHeight(0.1);
>         cylinderSource->SetResolution(100);
>
>         // Create a mapper and actor
>         vtkSmartPointer<vtkPolyDataMapper> mapper =
>                 vtkSmartPointer<vtkPolyDataMapper>::New();
>         mapper->SetInputConnection(cylinderSource->GetOutputPort());
>         vtkSmartPointer<vtkActor> actor =
>                 vtkSmartPointer<vtkActor>::New();
>         actor->SetMapper(mapper);
>
>
>         vtkSmartPointer< vtkOpenVRCamera > camera =
>                 vtkSmartPointer<vtkOpenVRCamera>::New();
>
>         //Create a renderer, render window, and interactor
>         vtkSmartPointer<vtkOpenVRRenderer> renderer =
>                 vtkSmartPointer<vtkOpenVRRenderer>::New();
>
>         renderer->SetActiveCamera(camera);
>
>         vtkSmartPointer<vtkOpenVRRenderWindow> renderWindow =
>                 vtkSmartPointer<vtkOpenVRRenderWindow>::New();
>         renderWindow->AddRenderer(renderer);
>         vtkSmartPointer<vtkOpenVRRenderWindowInteractor>
> renderWindowInteractor =
>                 vtkSmartPointer<vtkOpenVRRenderWindowInteractor>::New();
>         renderWindowInteractor->SetRenderWindow(renderWindow);
>
>         // Add the actor to the scene
>         renderer->AddActor(actor);
>         renderer->SetBackground(.1, .3, .2); // Background color dark green
>
>
>        // Render and interact
>         renderWindow->SetWindowName(argv[0]);
>         renderWindow->Render();
>         renderWindowInteractor->Start();
>
>         return EXIT_SUCCESS;
> }
> The demo room app works normally, so there might be a mistake with the code
> or the VS configuration, I'm not sure
>
> Thanks!
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.
> com/OpenVR-HTC-Vive-tp5743731p5743734.html
> Sent from the VTK - Dev mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170622/21b0aa6f/attachment.html>


More information about the vtk-developers mailing list