[vtkusers] How to tune the line with of vtkProperty2D

Ken Martin ken.martin at kitware.com
Wed Aug 24 09:41:20 EDT 2016


Your opengl driver tells VTK how wide of a line it can draw via something
like

      glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE,lineWidthRange);
      if (glGetError() == GL_NO_ERROR)
        {
        this->MaximumHardwareLineWidth = lineWidthRange[1];
        }

If your driver says it can handle lines up to 7.5 then VTK let's your
driver handle it. When you request a line greater than what your driver
says it can handle, VTK handles it itself. That is why you could see a
sudden discontinuity in line sizes. If your driver reports it can do wide
lines when in fact it doesn't you would see the behavior you described.
hence my suggestion on how to test for that.






On Tue, Aug 23, 2016 at 9:38 PM, Liu_tj <tjlp at netease.com> wrote:

> Correct some information. My computer runs on Windows 7. OpenGL is 3.3.
> Renderer is Intel(R) HD Graphics 4000.
>
>
>
> 在2016-08-24,"Liu_tj" <tjlp at netease.com> 写道:
>
> -----原始邮件-----
> *发件人:*"Liu_tj" <tjlp at netease.com>
> *发送时间:*2016年08月24日 星期三
> *收件人:*"Ken Martin" <ken.martin at kitware.com>
> *抄送:*"vtkusers" <vtkusers at vtk.org>
> *主题:*Re: [vtkusers] How to tune the line with of vtkProperty2D
>
> Hi, Ken,
>
> What do you mean "your hardware is saying it can draw wide lines up to 7.5
> pixels"? From my attachment, the effect of 8.0f is greatly wider than 7.5f.
> I am using VTK 7 with OpenGL2.
>
> Thanks
>
>
> 在2016-08-24,"Ken Martin" <ken.martin at kitware.com> 写道:
>
> -----原始邮件-----
> *发件人:*"Ken Martin" <ken.martin at kitware.com>
> *发送时间:*2016年08月24日 星期三
> *收件人:*"Liu_tj" <tjlp at netease.com>
> *抄送:*"vtkusers" <vtkusers at vtk.org>
> *主题:*Re: [vtkusers] How to tune the line with of vtkProperty2D
>
> It sounds like an openGL driver issue.  What version of VTK are you using
> and is it built with the OPenGL1 or OpenGL2 backend? What GPU is on the
> system you are using?
>
> Assuming you are using a recent VTK with OpenGL2 backend my guess is that
> your hardware is saying it can draw wide lines up to 7.5 pixels (though it
> seems not to), beyond that VTK is having to render the wide lines itself.
> That would be my guess. If you are using a recent VTK with the OPenGL2
> backend you can test this by modifying the HaveWideLines method in
> Rendering/OpenGL2/vtgkOpenGLPolyDataMapper2D.cxx
>
> change
>
>     return !(renWin &&
>       renWin->GetMaximumHardwareLineWidth() >= actor->GetProperty()->
> GetLineWidth());
>
> to
>
>     return true;
>
>
>
> On Mon, Aug 22, 2016 at 9:10 PM, Liu_tj <tjlp at netease.com> wrote:
>
>> Hi,
>>
>> I use vtkAngleWidget to measure angle. I want to tune the line width of
>> the angle leaders and arc. Below is my C# code:
>>
>>             m_angleWidget = vtkAngleWidget.New();
>>             m_angleWidget.SetInteractor(m_renderWin.GetInteractor());
>>             m_angleWidget.PlacePointEvt += new
>> vtkObject.vtkObjectEventHandler(AngleWidget_PlacePointEvt);
>>             m_angleRep = vtkAngleRepresentation2D.New();
>>             m_angleRep.GetRay1().GetProperty().SetColor(0.0, 1.0, 0.0);
>>             m_angleRep.GetRay1().GetProperty().SetLineWidth(8.0f);
>>             m_angleRep.GetRay2().GetProperty().SetColor(0.0, 1.0, 0.0);
>>             m_angleRep.GetRay2().GetProperty().SetLineWidth(8.0f);
>>             m_angleRep.GetArc().GetProperty().SetColor(0.0, 1.0, 0.0);
>>             m_angleRep.GetArc().GetProperty().SetLineWidth(8.0f);
>>             m_angleRep.GetArc().GetLabelTextProperty().SetColor(0.0,
>> 0.0, 1.0);
>>             m_angleWidget.SetRepresentation(m_angleRep);
>>
>> If I call SetLineWidth with 5.0f, 6.0f, 7.0f and 7.5f, I get the same
>> effect as 1.jpg; if I call SetLineWidth with 8.0f, the effect is as 2.jpg.
>> For me, the line in 1.jpg is too slim, the line in 2.jpg is too wide, how
>> to tune it?
>>
>> Thanks
>> Liu Peng
>>
>>
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
>
> --
> Ken Martin PhD
> Chairman & CFO
> Kitware Inc.
> 28 Corporate Drive
> Clifton Park NY 12065
> 518 371 3971
>
> This communication, including all attachments, contains confidential and
> legally privileged information, and it is intended only for the use of the
> addressee.  Access to this email by anyone else is unauthorized. If you are
> not the intended recipient, any disclosure, copying, distribution or any
> action taken in reliance on it is prohibited and may be unlawful. If you
> received this communication in error please notify us immediately and
> destroy the original message.  Thank you.
>
>
>
>
>
>
>
>
>



-- 
Ken Martin PhD
Chairman & CFO
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065
518 371 3971

This communication, including all attachments, contains confidential and
legally privileged information, and it is intended only for the use of the
addressee.  Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited and may be unlawful. If you
received this communication in error please notify us immediately and
destroy the original message.  Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160824/24d826be/attachment.html>


More information about the vtkusers mailing list