[vtkusers] How to create a polygon hole in a texture ?

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Tue Apr 8 17:21:06 EDT 2003


Hi Ingo,
   You should try the SetXResolution and SetYResolution with some 'higher'
values (16?) to clip your plane. I think the defaults are 1, so the plane
has just one quad, all four corners are outside the implicit sphere and the
clipper assumes there is no polygon to be clipped. Subdividing the plane
will allow the clipper to work. You may want even higher resolution to get
an accurate shaped hole.
I dont know how clippers handle textures, hopefully texture coordinates are
'clipped' too.
  regards
    Dave Pont


|--------+--------------------------------->
|        |          "De Boer Ingo"         |
|        |          <I.deBoer at polytec.de>  |
|        |          Sent by:               |
|        |          vtkusers-admin at public.k|
|        |          itware.com             |
|        |                                 |
|        |                                 |
|        |          08/04/2003 19:40       |
|        |                                 |
|--------+--------------------------------->
  >------------------------------------------------------------------------------------------------------------|
  |                                                                                                            |
  |      To:     <vtkusers at public.kitware.com>                                                                 |
  |      cc:                                                                                                   |
  |      Subject:     [vtkusers] How to create a polygon hole in a texture ?                                   |
  >------------------------------------------------------------------------------------------------------------|




Hi,

this is really killing me! How can I create a simple hole in my plane
texture?
I have something like:

float fAspectRatio  = (float)iImageWidth/(float)iImageHeight;

vtkBMPReader *bmpReader = vtkBMPReader::New();
bmpReader->SetFileName(cstrImageName);

vtkTexture *atext = vtkTexture::New();
atext->SetInput(bmpReader->GetOutput());

vtkPlaneSource *plane = vtkPlaneSource::New();
plane->SetOrigin( 0.0, 0.0, 0.0);
plane->SetPoint1( fAspectRatio*0.5, 0.0, 0.0);
plane->SetPoint2( 0.0, 0.5, 0.0);
plane->SetCenter( 0.0, 0.0, 0.0);

vtkPolyDataMapper *planeMapper = vtkPolyDataMapper::New();
planeMapper->SetInput(plane->GetOutput());

m_pvtkActor->SetMapper(planeMapper);
m_pvtkActor->SetTexture(atext);

m_pvtkRenderer->AddActor(m_pvtkActor);

Now, I want to put two holes in my texture, one triangle and one quad.
But I don't see how this works. I tried to use vtkClipDataSet in
combination
with vtkImplicitDataSet. But that didn't work out. I didn't get any hole.
Then I tried something like:

vtkSphere *sphere = vtkSphere::New();
sphere->SetRadius(.5);
sphere->SetCenter(0,0,0);
vtkClipPolyData *clipper = vtkClipPolyData::New();
clipper->SetInput(plane->GetOutput());
clipper->SetClipFunction(sphere);
clipper->GenerateClipScalarsOn();
clipper->GenerateClippedOutputOn();
clipper->SetValue(0);
..
planeMapper->SetInput(clipper->GetOutput());
..

Didn't work either.

any hints ? thanks...

greets
  Ingo
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers







More information about the vtkusers mailing list