[vtk-developers] VTK OpenGL2 Shaders

Ken Martin ken.martin at kitware.com
Fri Feb 5 13:20:30 EST 2016


Here is some info from an old email on customizing the polydatamapper
shaders. The PointGaussianMapper also supports custom shaders and there is
an example of that in
Rendering/OpenGL2/Testing/Cxx/TestPointGaussianMapperOpacity.cxx

Thanks

Ken


2)      *CUSTOM SHADERS* - Added support for customizing the default
PolyDataMapper shaders. You can now modify or completely replace the
default VTK shadersusing methods such as



AddShaderReplacement: replaces a strings in the current shader
SetVertexShaderCode: replaces the default shader template with your own

AddObserver(vtkCommand::UpdateShaderEvent,...)



These methods (and similar others) give you a great degree on control of
the VTK PolyData shaders. There are examples/tests in
Rendering/OpenGL2/Testing/Cxx/TestUserShader.cxx and TestUserShader2.cxx.
Through the UpdateShaderEvent you can modify the default VTK uniforms or
your own uniforms as desired. There is currently not a general purpose easy
API for binding your own data arrays to attributes but we may add one at
some point in the future. Currently VTK will send down the default
attributes for you to use in your shader (position, normal, tcoords,
colors, etc)



On Fri, Feb 5, 2016 at 12:11 PM, Aashish Chaudhary <
aashish.chaudhary at kitware.com> wrote:

> Not to my knowledge. Although we talked about it at-least having an API so
> that folks can replace the shader or ember new shader code to the existing
> one. Also, having some common convention would be nice.
>
> Thanks,
>
>
>
>
> On Fri, Feb 5, 2016 at 11:31 AM, Steve Pieper <pieper at isomics.com> wrote:
>
>> Hi Bill -
>>
>> Great question - I'm looking forward to hear what folks have been doing
>> in this respect.
>>
>> For me, I have two classes I have been testing with Slicer - one that
>> manages 3D textures and one that implements shaders [1,2].  We worked on it
>> at project week [3] and I'm liking how it works.
>>
>> -Steve
>>
>> [1]
>> https://github.com/pieper/CommonGL/blob/master/ShadedActor/Logic/vtkOpenGLTextureImage.h
>>
>> [2]
>> https://github.com/pieper/CommonGL/blob/master/ShadedActor/Logic/vtkOpenGLShaderComputation.h
>>
>> [3]
>> http://www.na-mic.org/Wiki/index.php/2016_Winter_Project_Week/Projects/CommonGL
>>
>> On Fri, Feb 5, 2016 at 11:10 AM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>>
>>> Folks,
>>>
>>> Is there documentation on how to write glsl shaders for VTK?
>>>
>>> Bill
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Search the list archives at:
>>> http://markmail.org/search/?q=vtk-developers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>
>>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>>
>>
>
>
> --
>
>
>
> *| Aashish Chaudhary | Technical Leader         | Kitware Inc.            *
> *| http://www.kitware.com/company/team/chaudhary.html
> <http://www.kitware.com/company/team/chaudhary.html>*
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>


-- 
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/vtk-developers/attachments/20160205/f39c3464/attachment-0001.html>


More information about the vtk-developers mailing list