[vtk-developers] GLSL Shader on a vtkActor (VTK 6.1 and Qt 5.2.1)

Marcus D. Hanwell marcus.hanwell at kitware.com
Tue Jul 8 15:40:30 EDT 2014


I don't think that would be useful at this time - whilst the new
rendering code is shader based we have not yet started to add
functionality to add your own or modify our shader code.

On Tue, Jul 8, 2014 at 3:07 PM, Aashish Chaudhary
<aashish.chaudhary at kitware.com> wrote:
> I can reply in detail layer but on this note, you may want to use the new
> VTK rendering code for it. Marcus or Ken hopefully reply to you on that.
>
> - Aashish
>
>
> On Tue, Jul 8, 2014 at 2:14 PM, Carlos Martinez <carlinhosmp87 at gmail.com>
> wrote:
>>
>> Thanks for your answer, i thought it wasn't the right way!
>>
>> What do you mean when you say i have to load the shaders manually? The
>> steps i'm doing are:
>>
>> 1- Create a vtkShaderProgram2
>> 2- Create the vtkShader2 (VertexShader) and load it from the file with
>> SetSourceCode.
>> 3- Add my VertexShader to the vtkShaderProgram2 with
>> "GetShaders()->AddItem()".
>> 4- Repeat 2 and 3 with the FragmentShader.
>> 5- Build the vtkShaderProgram and check the Build Status (to check if
>> everything is ok).
>> 6- Create a vtkActor and obtain his property(with GetProperty()).
>> 7- Put ShadingOn to the property and SetPropProgram with the
>> vtkShaderProgram2 build before (The vtkShaderProgram on debug has only the 2
>> shaders I put in).
>>
>> When the actors are going to display into the screen, the warning window
>> shows up and tells me that the main is defined twice (and shows me the
>> Default shaders and mine).
>>
>> Thanks again!!
>>
>>
>> 2014-07-08 18:25 GMT+02:00 Aashish Chaudhary
>> <aashish.chaudhary at kitware.com>:
>>
>>> vtkOpenGLProperty::SetPropProgram is the right function but you have load
>>> your shaders manually now. I believe the error you are getting is because it
>>> is still trying to use the last shader code.
>>>
>>> - Aashish
>>>
>>>
>>>
>>> On Tue, Jul 8, 2014 at 3:15 AM, carlinhos <carlinhosmp87 at gmail.com>
>>> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I'm using Vtk 6.1.0 and Qt 5.2.1 (C++) to develop my app.
>>>>
>>>> I have an assembly with different actors into a vtkRenderWindow.
>>>>
>>>> I load a shader with the class vtkShader2, and create the program with
>>>> vtkShaderProgram2, all ok with this. After that, i wanted to attach the
>>>> shader to the actors (i'm going to use different shaders, depending on
>>>> the
>>>> actors). The problem is i didn't find examples or documentation to do
>>>> this
>>>> and i'm not capable to use the classes for the shaders correctly.
>>>>
>>>> I searched into the class vtkOpenGLProperty to set the vtkShaderProgram2
>>>> with the method "SetPropProgram" and i set the property of the actors
>>>> with
>>>> that one, but vtk shows me a warning window with a conflict between the
>>>> default shaders and mine (total 4 shaders, 2 vertex and 2 fragment).
>>>>
>>>> Can someone help me? Thanks in advance!!
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://vtk.1045678.n5.nabble.com/GLSL-Shader-on-a-vtkActor-VTK-6-1-and-Qt-5-2-1-tp5727788.html
>>>> Sent from the VTK - Dev mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> 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
>>
>>
>
>
>
> --
> | Aashish Chaudhary
> | Technical Leader
> | Kitware Inc.
> | 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
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list