[vtkusers] How to use SetGeometryShaderCode
ken.martin at kitware.com
Mon Jul 9 10:20:16 EDT 2018
Glad that helped Kumar, I don't have time to dig into your specific code,
but when I run into shader issues I usually try hardcoding parts of the
shader or simplifying parts until I get to a point where it is simple
enough to track down the issue. In this case as you are seieng lines but
they are not wide, seems like something is bad in your computed vertex
positions in the GS
On Mon, Jul 9, 2018 at 10:04 AM, Kumar Ashutosh <kumar.ashutosh.ee at gmail.com
> Thanks, Ken for showing interest in this issue.
> You were correct that a uniform value was defaulting to 0.0. So I manually
> replaced them with a vec2. The line does render now but the behaves only as
> a normal line and not as a WideLine. My implementation can be seen here
> In this code, case1 is the normal line, case2 is with
> SetRenderLineAsTubes() and case3 is the manual GS part which I am trying to
> implement. I have replaced the uniform vec2 variable lineWidthNVC with
> vec2(0.1, 0.1) . This renders as a normal line and not as a Tube. Kindly
> see if I am making any mistake in injecting the shader.
> Kumar Ashutosh
> On Mon, Jul 9, 2018 at 8:54 PM, Ken Martin <ken.martin at kitware.com> wrote:
>> Using your own shader code is a bit advanced as there are a few moving
>> parts. If you specify geometry shader code then you also have to make sure
>> the right uniforms/arrays are being set for that shader code. That would be
>> my guess as to the issue with your attempt to manually specify wide lines.
>> Maybe the code is fine but some uniforms are not properly set and so are
>> defaulting to 0.0 etc.
>> I agree an example of geometry replacements would be good. If you get
>> something working let me know and I'll add it to the wiki page on custom
>> On Wed, Jul 4, 2018 at 9:11 AM, Kumar Ashutosh <
>> kumar.ashutosh.ee at gmail.com> wrote:
>>> I want to add custom Geometry Shader to my mapper. From the source code,
>>> I concluded that in vtkOpenGLPolyDataMapper we can inject custom Shader
>>> Code. Also, the code has WideLineGS as the default Geometry Shader. I tried
>>> to mimic the same behaviour by injecting the same code as given here
>>> <https://gitlab.kitware.com/vtk/vtk/blob/master/Rendering/OpenGL2/glsl/vtkPolyDataWideLineGS.glsl> (source
>>> code of WideLinesGS) using the function SetGeometryShaderCode. The
>>> resulting screen is a blank screen with no errors raised.
>>> Can someone please guide me on how to inject Geometry Shader Code. This
>>> is specific to Geometry Shader only as I have successfully tried with Frag
>>> Shader and Vertex Shader.
>>> A simple example of this would be great.
>>> Kumar Ashutosh
>>> Powered by www.kitware.com
>>> Visit other Kitware open-source projects at
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>>> Follow this link to subscribe/unsubscribe:
>> Ken Martin PhD
>> Distinguished Engineer
>> Kitware Inc.
>> 101 East Weaver Street
>> Carrboro, North Carolina
>> 27510 USA
>> 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
101 East Weaver Street
Carrboro, North Carolina
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...
More information about the vtkusers