<div dir="ltr">Here is an example and a screenshot to illustrate the issue.<div><br></div><div>I'm wondering if the coordinates returned in vtkOpenGLPolyDataMapper2D::RenderOverlay by the call to <br></div><div>this->TransformCoordinate->GetComputedDoubleViewportValue(viewport); should be then shifted with the extra 0.5 to be in the center of the pixel and not in the border.<br></div><div><br></div><div><br></div><div><div>#define vtkRenderingCore_AUTOINIT 4(vtkInteractionStyle, vtkRenderingOpenGL, vtkRenderingFreeType,vtkRenderingFreeTypeOpenGL)</div><div><br></div><div>#include <vtkActor2D.h></div><div>#include <vtkPolyDataMapper2D.h></div><div>#include <vtkRenderer.h></div><div>#include <vtkPlaneSource.h></div><div>#include <vtkRenderWindow.h></div><div>#include <vtkRenderWindowInteractor.h></div><div>#include <vtkSmartPointer.h></div><div>#include <vtkCoordinate.h></div><div>#include <vtkPointData.h></div><div><br></div><div>int main(int, char* [])</div><div>{</div><div>   vtkSmartPointer<vtkRenderer> ren1= vtkSmartPointer<vtkRenderer>::New();</div><div>   vtkSmartPointer<vtkRenderWindow> renWin= vtkSmartPointer<vtkRenderWindow>::New();</div><div>   renWin->SetSize( 1533, 792 );</div><div>   renWin->AddRenderer(ren1);</div><div><br></div><div>   vtkSmartPointer<vtkRenderWindowInteractor> iren= vtkSmartPointer<vtkRenderWindowInteractor>::New();</div><div>   iren->SetRenderWindow(renWin);</div><div><br></div><div>   vtkSmartPointer<vtkPlaneSource> source = vtkSmartPointer<vtkPlaneSource>::New();</div><div>   source->SetOrigin(0.0, 0.0, 0.0);</div><div>   source->SetPoint1(1.0, 0.0, 0.0);</div><div>   source->SetPoint2(0.0, 1.0, 0.0);</div><div>   source->Update();</div><div><br></div><div>   vtkSmartPointer<vtkUnsignedCharArray> scalars = vtkSmartPointer<vtkUnsignedCharArray>::New();</div><div>   double bottom[3] = {255.0, 0, 0};</div><div>   double top[3] = {0, 255.0, 0};</div><div>   scalars->Initialize();</div><div>   scalars->SetNumberOfComponents(3);</div><div>   scalars->SetNumberOfTuples(4);</div><div>   scalars->InsertTuple(0, bottom);</div><div>   scalars->InsertTuple(1, bottom);</div><div>   scalars->InsertTuple(2, top);</div><div>   scalars->InsertTuple(3, top);</div><div>   source->GetOutput()->GetPointData()->SetScalars(scalars);</div><div><br></div><div>   vtkSmartPointer<vtkCoordinate> coordinateSystem = vtkSmartPointer<vtkCoordinate>::New();</div><div>   coordinateSystem->SetCoordinateSystemToNormalizedViewport();</div><div><br></div><div>   vtkSmartPointer<vtkPolyDataMapper2D> mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();</div><div>   mapper->SetInputConnection(source->GetOutputPort());</div><div>   mapper->SetTransformCoordinate(coordinateSystem);</div><div>   mapper->TransformCoordinateUseDoubleOn();</div><div><br></div><div>   vtkSmartPointer<vtkActor2D> actor2d = vtkSmartPointer<vtkActor2D>::New();</div><div>   actor2d->SetMapper(mapper);</div><div><br></div><div>   ren1->AddActor(actor2d);</div><div><br></div><div>   ren1->ResetCamera();</div><div>   renWin->Render();</div><div>   iren->Start();</div></div><div>}</div><div><br></div><div><img src="cid:ii_14e48ce35d944ab8" alt="Images intégrées 1" width="253" height="182"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-06-30 18:18 GMT+02:00 Xabi Riobe <span dir="ltr"><<a href="mailto:xabivtk@gmail.com" target="_blank">xabivtk@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I want to display a plane as a background.</div><div>For that i have in a vtkActor2D a vtkPolyDataMapper2D filled with a vtkPlaneSource going from 0,0,0 to 1,1,1</div><div>I add to the mapper a vtkCoordinate with SetCoordinateSystemToNormalizedViewport</div><div><br></div><div>with that, everything seems fine and i don't have to take care of it when my view is resized.</div><div><br></div><div>but if i put some color on it and look at it carefully i can see an extra line and column of black pixels</div><div><br></div><div>I looked at the code of vtkCoordinate and vtkViewport and the combination of the coordinates transformations leads to a final size of the polygon rendered 1 pixel short in both x and y directions.</div><div><br></div><div>Is this considered a normal behaviour due to the computation involved, or is it definitively a bug?</div><div><br></div><div>A quick workaround is to set my plane source a little bit larger, but for future features of my app, i would need the exact size...</div><div><br></div><div>Thanks for any comments/suggestions</div><div><br></div></div>
</blockquote></div><br></div>