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

carlinhos carlinhosmp87 at gmail.com
Tue Jul 29 15:48:54 EDT 2014


Joachim,

Thank you so much for the explanation, I tried something similar but
building the shaders instead of not doing it (if I remember well).
Tomorrow i will try it and I will tell you the results!!

Carlos.




2014-07-29 15:14 GMT+02:00 Joachim Pouderoux [via VTK] <
ml-node+s1045678n5728004h64 at n5.nabble.com>:

> Carlos
>
> Ok actually I was wrong. My patch works but it is not how this is supposed
> to happen.
> Basically, VTK will merge 2 different shader source code to define each
> type of shader (vertex, fragment etc.).
> A first source will come from the shader code that can be attached to the
> renderer shaders.
> If it not exist, the default is a main function that will call
> propFuncVS()/propFuncFS() etc - depending the shader type.
> The second source will come from the shader code that can be attached to
> the actor's property.
> If it not exist, the default behaviour is to define that propFuncVS/FS
> functions.
> Both source codes will be appended before being compiled by the
> openGlProperty.
>
> So basically if you do not define a renderer shader program, you simply
> have to provide a shader codes to your property that defines propFuncVS/FS
> functions instead of usual main() functions.
> Also do not build your shader program (program->Build()) in your code as
> it will fail because the main() functions are not provided. Remember they
> will be added later automatically before compilation by OpenGLProperty.
>
> Hope it is clear and it helps!
>
> Best,
>
>
>
> *Joachim Pouderoux*
>
> *PhD, Technical Expert*
> *Kitware SAS <http://www.kitware.fr>*
>
>
>
> 2014-07-29 14:55 GMT+02:00 Joachim Pouderoux <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=5728004&i=0>>:
>
>> Actually it seems like there is a bug in vtkOpenGLProperty.cxx that I
>> might have fixed. I will make a patch soon.
>> In the meanwhile try to change those lines:
>>
>>
>>         needDefaultMainVS = !progHasVertex
>>           && propProg->HasVertexShaders();
>>         needDefaultMainFS = !progHasFragment
>>           && propProg->HasFragmentShaders();
>>
>> by
>>
>>         needDefaultMainVS = !progHasVertex
>>           && !propProg->HasVertexShaders();
>>         needDefaultMainFS = !progHasFragment
>>           && !propProg->HasFragmentShaders();
>>
>> With that fixed, the steps you defined should now work as no second
>> main() will be added to both shader code.
>>
>> Joachim
>>
>> *Joachim Pouderoux*
>>
>> *PhD, Technical Expert*
>> *Kitware SAS <http://www.kitware.fr>*
>>
>>
>>
>> 2014-07-18 11:03 GMT+02:00 carlinhos <[hidden email]
>> <http://user/SendEmail.jtp?type=node&node=5728004&i=1>>:
>>
>>  Hello Xiaoming,
>>>
>>> I created a new vtkOpenGLProperty and set it to the actor, anyways i
>>> tried to cast the vtkProperty obtained by the a vtkActor::GetProperty(),
>>> because vtkProperty is an abstract class. I tried so many things to make it
>>> work but i didn't manage to do it. Also i tried to use vtkOpenGLActors
>>> instead of vtkActors but it also didn't work.
>>>
>>> Carlos.
>>>
>>>
>>> 2014-07-18 9:46 GMT+02:00 xiaoming [via VTK] <[hidden email]
>>> <http://user/SendEmail.jtp?type=node&node=5727905&i=0>>:
>>>
>>>> i'm sorry but i see that vtkActor::GetProperty() returns a pointer to
>>>> the vtkProperty not vtkOpenGLProperty,which has a member of
>>>> SetPropProgram,i 'm just confused with the 7th step,would you bother to
>>>> tell me sth about that ,thanks in advance.
>>>> Quote:
>>>> <  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).>
>>>>
>>>>
>>>>
>>>> ------------------------------
>>>>  If you reply to this email, your message will be added to the
>>>> discussion below:
>>>>
>>>> http://vtk.1045678.n5.nabble.com/GLSL-Shader-on-a-vtkActor-VTK-6-1-and-Qt-5-2-1-tp5727788p5727903.html
>>>>  To unsubscribe from GLSL Shader on a vtkActor (VTK 6.1 and Qt 5.2.1), click
>>>> here.
>>>> NAML
>>>> <http://vtk.1045678.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>>>
>>>
>>>
>>> ------------------------------
>>> View this message in context: Re: GLSL Shader on a vtkActor (VTK 6.1
>>> and Qt 5.2.1)
>>> <http://vtk.1045678.n5.nabble.com/GLSL-Shader-on-a-vtkActor-VTK-6-1-and-Qt-5-2-1-tp5727788p5727905.html>
>>>  Sent from the VTK - Dev mailing list archive
>>> <http://vtk.1045678.n5.nabble.com/VTK-Dev-f1251487.html> 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
>>>
>>>
>>>
>>
>
> _______________________________________________
> 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
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://vtk.1045678.n5.nabble.com/GLSL-Shader-on-a-vtkActor-VTK-6-1-and-Qt-5-2-1-tp5727788p5728004.html
>  To unsubscribe from GLSL Shader on a vtkActor (VTK 6.1 and Qt 5.2.1), click
> here
> <http://vtk.1045678.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5727788&code=Y2FybGluaG9zbXA4N0BnbWFpbC5jb218NTcyNzc4OHwtMTY5NTc0MDIy>
> .
> NAML
> <http://vtk.1045678.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://vtk.1045678.n5.nabble.com/GLSL-Shader-on-a-vtkActor-VTK-6-1-and-Qt-5-2-1-tp5727788p5728009.html
Sent from the VTK - Dev mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20140729/f1da08f9/attachment-0002.html>


More information about the vtk-developers mailing list