# vtkContourWidget show no lines

**URL:** https://discourse.vtk.org/t/vtkcontourwidget-show-no-lines/2640
**Category:** Support
**Created:** [February 17, 2020, 9:23am UTC](https://discourse.vtk.org/t/vtkcontourwidget-show-no-lines/2640 "2020-02-17T09:23:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![snow](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/ba9def/32.png) [@snow](https://discourse.vtk.org/u/snow)
#### Post date: [February 17, 2020, 9:23am UTC](https://discourse.vtk.org/t/vtkcontourwidget-show-no-lines/2640/1 "2020-02-17T09:23:55Z")

</div>

I’m vtk beginner , i have problems when i used vtkContourWidget with vtkOrientedGlyphFocalPlaneContourRepresentation . I want to create a contour on the screen coordinate, not world coordinate. so I write some code ,try to achieve it. But some problems makes me confused, there is only points but no line , and I do not know why this happeded.  
Could anyone point out what my problem is? Thank you very much!  
my vtk version is vtk 8.2  
here is the code :

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* code \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
#include “pch.h”  
#include

#include \<vtkSmartPointer.h\>  
#include \<vtkContourWidget.h\>  
#include \<vtkProperty.h\>  
#include \<vtkProperty2D.h\>  
#include \<vtkOrientedGlyphContourRepresentation.h\>  
#include \<vtkPolyData.h\>  
#include \<vtkCellArray.h\>  
#include \<vtkPoints.h\>  
#include \<vtkMath.h\>  
#include \<vtkRenderer.h\>  
#include \<vtkRenderWindow.h\>  
#include \<vtkRenderWindowInteractor.h\>  
#include \<vtkInteractorStyleTrackballCamera.h\>  
#include \<vtkOrientedGlyphFocalPlaneContourRepresentation.h\>  
#include \<vtkContourLineInterpolator.h\>

#include “vtkAutoInit.h”  
VTK\_MODULE\_INIT(vtkRenderingOpenGL2); // VTK was built with vtkRenderingOpenGL2  
VTK\_MODULE\_INIT(vtkInteractionStyle);  
VTK\_MODULE\_INIT(vtkRenderingFreeType);  
VTK\_MODULE\_INIT(vtkRenderingVolumeOpenGL2);

int main()  
{  
vtkSmartPointer contourWidget =  
vtkSmartPointer::New();

```
vtkSmartPointer< vtkOrientedGlyphFocalPlaneContourRepresentation> conRep =
	vtkSmartPointer< vtkOrientedGlyphFocalPlaneContourRepresentation>::New();
conRep->GetLinesProperty()->SetColor(1, 1, 0);
conRep->GetLinesProperty()->SetLineWidth(5);
contourWidget->SetRepresentation(conRep);

vtkSmartPointer<vtkRenderer> renderer =
	vtkSmartPointer<vtkRenderer>::New();
renderer->SetBackground(0.1, 0.2, 0.4); 

vtkSmartPointer<vtkRenderWindow> renderWindow =
	vtkSmartPointer<vtkRenderWindow>::New();
renderWindow->AddRenderer(renderer);

vtkSmartPointer<vtkRenderWindowInteractor> interactor =
	vtkSmartPointer<vtkRenderWindowInteractor>::New();
interactor->SetRenderWindow(renderWindow);

vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
	vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
interactor->SetInteractorStyle(style);

renderer->ResetCamera(); 

renderWindow->Render();

contourWidget->SetInteractor(interactor);
contourWidget->On(); 

conRep->ClosedLoopOn();
conRep->AddNodeAtDisplayPosition(100, 100);
conRep->AddNodeAtDisplayPosition(200, 100);
conRep->AddNodeAtDisplayPosition(200, 200);
conRep->AddNodeAtDisplayPosition(100, 200);

for (int i = 0; i < 4; i++) {
	conRep->UpdateLines(i);
}

conRep->BuildRepresentation();
conRep->UpdateContour();
conRep->VisibilityOn();
contourWidget->SetWidgetState(vtkContourWidget::Manipulate);
interactor->Start();
return 0;

```

}

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\* code \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*
