[vtkusers] How to use SetGeometryShaderCode

Kumar Ashutosh kumar.ashutosh.ee at gmail.com
Mon Jul 9 10:04:06 EDT 2018


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
<https://gist.github.com/thechargedneutron/0cfb5abb9531279bf9f80d6f38410aaf>.
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.

Regards,
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
> shaders.
>
> 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.
>>
>> Regards,
>> Kumar Ashutosh
>>>>
>> _______________________________________________
>> 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:
>> https://public.kitware.com/mailman/listinfo/vtkusers
>>
>>
>
>
> --
> Ken Martin PhD
> Distinguished Engineer
> Kitware Inc.
> 101 East Weaver Street
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+%0D%0A27510+USA&entry=gmail&source=g>
> Carrboro, North Carolina
> <https://maps.google.com/?q=101+East+Weaver+Street+Carrboro,+North+Carolina+%0D%0A27510+USA&entry=gmail&source=g>
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtkusers/attachments/20180709/dcfb04d4/attachment-0001.html>


More information about the vtkusers mailing list