[vtkusers] VTK for VR

Denis Shamonin dshamoni at science.uva.nl
Thu Jul 3 05:40:06 EDT 2003


Luis Miguel De La Cruz Salas wrote:

>Hello everyone,
>
>I wonder if someone have used VTK for displaying in Virtual Reality
>systems (I mean immersadesk, CAVEs, Panorams, etc)?.
>How do you controls things like stereo, edge blending, distortion,
>tracking, devices (wands, gloves) etc?.
>
Hi,

I did beta library VtkCave. http://carol.wins.uva.nl/~dshamoni/VtkCave/
And tested it as well on our DRIVE system. 
http://carol.wins.uva.nl/~robbel/DRIVE/
Also tried to test it in real CAVE in SARA http://www.sara.nl
Problem was that SARA don't have latest version of CAVE library 3.1. 
That it, no way.
But for this moment it doesn't work with new VTK 4.2. :( That why I 
removed it from link above.
It worked well with VTK 4.1.1 and threaded version CAVE library 3.1
Still need some time to finish it and update, but too busy now.

Also you can have a look some of Robbel Belleman works 
http://carol.wins.uva.nl/~robbel/
He also work a lot with VTK + CAVE you can ask him. He made a lot of 
things with vtk2CAVE library to update and improve it

The idea of VtkCave was too make it easy porting VTK program in to CAVE.
Simple example from VtkCave library look like this:
/*=========================================================================

  Program:   VtkCave
  Module:    $RCSfile: CaveActor.cxx,v $
  Language:  C++
  Date:        $Date: 2002/07/11 13:08:50 $
  Version:   $Revision: 1.3 $

  Copyright (c) 2002 Denis Shamonin
  All rights reserved.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// Simple example using vtkCaveActor. Press Button1 when the ray 
intersect the object
// for Manipulate the Cone, Button2 when the ray intersect the object to 
change modes
// of manipulation, Button3 when the ray intersect the object to change 
modes navigation
// Have a look more about interaction in vtkCaveInteractorStyle.h, 
vtkCaveActor or read
// documentation

#include <vtkConeSource.h>
#include <vtkPolyDataMapper.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkTransform.h>
#include <vtkCubeSource.h>
#include <vtkLight.h>
#include "vtkCaveRenderer.h"
#include "vtkCaveRenderWindow.h"
#include "vtkCaveRenderWindowInteractor.h"
#include "vtkCaveActor.h"

int main( int argc, char *argv[] )
{
  // Cave configure
  CAVEConfigure(&argc,argv,NULL); 
  // create a rendering window and renderer
  vtkCaveRenderer *ren = vtkCaveRenderer::New();
  vtkCaveRenderWindow *renWindow = vtkCaveRenderWindow::New();
    renWindow->AddRenderer(ren);
  vtkCaveRenderWindowInteractor *iren = 
vtkCaveRenderWindowInteractor::New();
    iren->SetRenderWindow(renWindow);

  // create an actor and give it cone geometry
  vtkConeSource *cone = vtkConeSource::New();
   cone->SetHeight(2);
   cone->SetRadius(1);
   cone->SetResolution(30);
  vtkTransform *trans = vtkTransform::New();
   trans->Translate(0.0,5.0,0.0);
  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
   coneMapper->SetInput(cone->GetOutput());

  vtkCaveActor *coneActor = vtkCaveActor::New();
   coneActor->SetMapper(coneMapper);
   coneActor->SetTransform(trans);
   coneActor->AddRenderer(ren);
   coneActor->GetProperty()->SetColor(1,1,0);
   trans->Translate(0.0,0.0,-4.0);

  vtkLight *light1 = vtkLight::New();
    light1->SetPosition(2.5, -2.5, 0.0);
  vtkLight *light2 = vtkLight::New();
    light2->SetPosition(-2.5, 2.5, 2.5);

  ren->AddActor(coneActor);
  ren->AddLight(light1);
  ren->AddLight(light2);

  iren->Start();

  // Clean up
  CAVEExit();
  ren->Delete();
  renWindow->Delete();
  iren->Delete();
}

-- 
Denis Shamonin
Address       : Section Computational Science
                University of Amsterdam
                Kruislaan 403, 1098 SJ Amsterdam
                The Netherlands

E-mail        : dshamoni at science.uva.nl
URL           : http://www.science.uva.nl/~dshamoni/

Office number : +31 20 525 7542






More information about the vtkusers mailing list