[vtkusers] RE: starter help...

Evert Koopman e.a.koopman at chello.nl
Wed Jan 23 04:08:53 EST 2002


You probably have 256 colours on your desktop, also check if cone.c does
have an interactor (an instance of vtkRenderWindowInteractor) so when it
finishes rendering the program doesn't quit.

For example try compiling this program, this shouldn't quit and give you a
grey cone on a black background as long as your mouse cursor is over the
window.
----------------------------------------------------------------------------
--------
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"

int main(void)
{

  // Create the renderwindow, renderer and interactor
  vtkRenderer *ren1 = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
    renWin->AddRenderer(ren1);
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);

  // Create a polygonal cone
  vtkConeSource *cone = vtkConeSource::New();
    cone->SetRadius(1.0);
    cone->SetHeight(1.0);
    cone->SetAngle(30.0);
    cone->SetResolution(15);

  // Map the polygons to graphics data
  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
    coneMapper->SetInput(cone->GetOutput());

  // Create an actor for this graphics object
  vtkActor *coneActor = vtkActor::New();
    coneActor->SetMapper(coneMapper);
    coneActor->GetProperty()->SetColor(0.2, 0.2, 0.2);

  // Add the actor to the renderer
  ren1->AddActor(coneActor);

  // Set the background colour to gray
  ren1->SetBackground(0.0, 0.0, 0.0);

  // Render the image
  renWin->Render();

  //  Begin mouse interaction
  iren->Start();

  // Code at this line and below is never reached

}
----------------------------------------------------------------------------
------
Date: Tue, 22 Jan 2002 18:20:13 -0600 (CST)
From: Chuanxi Xu <xuc at cis.uab.edu>
Reply-To: Chuanxi Xu <xuc at cis.uab.edu>
To: vtkusers at public.kitware.com
Subject: [vtkusers] starter help...

  Hi,everyone!
  I just got started with VTK under Solaris.I got something terrible when I
tried to run a demo Cone.c (the compilation was successful),the desktop
becomes
dark blue as the application window pops up.There's no cone and program
quits in
a couple of seconds.
  What was going on??
  Appreciate your attention!!


  Chris at uab




--__--__--

_______________________________________________
vtkusers mailing list
vtkusers at public.kitware.com
http://public.kitware.com/mailman/listinfo/vtkusers


End of vtkusers Digest





More information about the vtkusers mailing list