# vtkLineSource in glyph3D wrong resolution

**URL:** https://discourse.vtk.org/t/vtklinesource-in-glyph3d-wrong-resolution/13230
**Category:** Support
**Tags:** code
**Created:** [February 2, 2024, 8:10am UTC](https://discourse.vtk.org/t/vtklinesource-in-glyph3d-wrong-resolution/13230 "2024-02-02T08:10:27Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CharInt0](https://discourse.vtk.org/user_avatar/discourse.vtk.org/charint0/32/2983_2.png) [@CharInt0](https://discourse.vtk.org/u/CharInt0)
#### Post date: [February 2, 2024, 8:10am UTC](https://discourse.vtk.org/t/vtklinesource-in-glyph3d-wrong-resolution/13230/1 "2024-02-02T08:10:27Z")

</div>

Hi all,  
I am trying to create glyph3D passing a source composed by two spheres and a line. However when I add the vtkLineSource to the sources, the resolution is wrong: (VTK 9.2)

![image](https://discourse.vtk.org/uploads/default/original/2X/5/58a6f5f1ab571a1d63b21b7ef25a5f5f66b94ab9.png)

Instead when I don’t add the line to the sources the resolution is fine:  
 ![image](https://discourse.vtk.org/uploads/default/original/2X/d/dbb5be3cc45e2c910cce808d5dccf78c417ef2a6.png)

How can I fix this? Here is my code:

```auto
// Create the sources:
std::vector<vtkSmartPointer<vtkPolyDataAlgorithm>> sources;
// Line source 
// comment these lines to obtain the second image --------------
auto* lineS = vtkLineSource::New();
lineS->SetResolution(25);
lineS->SetPoint1(m_startPoint.x, m_startPoint.y, m_startPoint.z);
lineS->SetPoint2(m_endPoint.x, m_endPoint.y, m_endPoint.z);

auto lineSource = vtkSmartPointer<vtkLineSource>::New();
lineSource.TakeReference(lineS);
sources.push_back(lineSource);
//-------------------------------------------------------------------------
// Sphere source 1
auto* sphereStart = vtkSphereSource::New();
sphereStart->SetPhiResolution(12);
sphereStart->SetThetaResolution(12);
sphereStart->SetCenter(m_startPoint.x, m_startPoint.y, m_startPoint.z);
sphereStart->SetRadius(m_radius);

auto sphereStartSource = vtkSmartPointer<vtkSphereSource>::New();
sphereStartSource.TakeReference(sphereStart);
sources.push_back(sphereStartSource);
// Sphere source 2
auto* sphereEnd = vtkSphereSource::New();
sphereEnd->SetPhiResolution(12);
sphereEnd->SetThetaResolution(12);
sphereEnd->SetCenter(m_endPoint.x, m_endPoint.y, m_endPoint.z);
sphereEnd->SetRadius(m_radius);

auto sphereEndSource = vtkSmartPointer<vtkSphereSource>::New();
sphereEndSource.TakeReference(sphereEnd);
sources.push_back(sphereEndSource);

// Create the glyph3D
vtkNew<vtkAppendPolyData> appendData;

for (auto source : sources)
{
	appendData->AddInputConnection(source->GetOutputPort());
}

auto* glyph3D = vtkGlyph3D::New();
glyph3D->SetColorModeToColorByScalar();
//glyph3D->SetIndexModeToScalar();
glyph3D->SetSourceConnection(appendData->GetOutputPort());
glyph3D->SetInputData(data);
glyph3D->SetScaleFactor(scaleFactor);
glyph3D->Update();

```

(the issue persists with VTK version 9.3)  
Thank you,  
C.R.
