[vtkusers] Smooth edged cubes in vtk

Hari Menon harik87 at gmail.com
Tue Jan 3 03:00:02 EST 2012


Hi all,
  I have a requirement to draw different sized cubes in a vtk render
window. I done this by using vtkCubeSource and works well. Code snippet is
given below.
for(int i=0; i<numberOfPoints; i++)
{
    vtkCubeSource* cube = vtkCubeSource::New();
    vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
    vtkActor* cubeActor = vtkActor::New();
    cube->SetCenter(xPoint,yPoint,zHeight);
    cube->SetXLength(m_CubeDimension);
    cube->SetYLength(m_CubeDimension);
    cube->SetZLength(m_Height);
    mapper->SetInputConnection(cube->GetOutputPort());
    cubeActor->SetMapper(mapper);
    m_Renderer->AddActor(cubeActor);
    cubeActor->Delete();
    mapper->Delete();
    cube->Delete();
}

What my question is: When the renderer is rotated or moved, the edges of
cubes are getting blurred which is very annoying. Is there any method to
avoid this issue.
I have tried using LineSmoothingOn, PolygonSmoothingOn,PointSmoothingOn of
renderwindow, but not use.By turning LineSmoothingOn, lines drawing are
smoothened, but when cubes or circles are drawn, the edges are not
smoothened.
Also tried using vtkSmoothPolyDataFilter on the cube source, but not
working.

Thanks in advance.
Hari
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120103/ecd0ff66/attachment.htm>


More information about the vtkusers mailing list