[vtk-developers] hardware shaders

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Tue Oct 18 15:29:49 EDT 2005


Hi Gary, Tim,

Since it didn't involve much effort, I've gone ahead and added
Add/RemoveShader API to the ShaderProgram.  Rest of the code was already
well equipped to accept multiple shaders. Since Cg has limitations, I
will soon add restrictions on the number of shaders of each type that
can be  added.

Also, as a side note, Cg/GLSL tests have been added. They should also
serve as a example for anyone who is wondering how to start using shaders.

Utkarsh.

Gary J. Templet wrote:
> Hi Tim,
> 
> You are correct, the vtkShader* classes assume that you will only link a
> single vertex and a single fragment shader at any one time. This is not
> an inherent limitation of the code, it's just not something that's been
> implemented yet. In fact the XML parsers/readers that handle shaders
> were written with the thought of having multiple shaders (or either
> type) defined in the Material file.
> 
> Support for hardware shaders is still in development, but allowing GLSL
> to link multiple shaders is on the list of requirements. A more general
> {Add,Remove}Shader(vtkShader*) member function is a good idea for it's
> implemenation.
> 
> It may not map well to Cg, but that shouldn't limit GLSL functionality;
> I think Cg has some capability to facilitate code re-use. If you have
> any more use cases for shaders I'd be happy to hear them.
> 
> Thanks,
> Gary
> 
> 
> 
> Tim Peeters wrote:
> 
>> Hello,
>>
>> I created some VTK classes for managing GLSL shaders to use in my own
>> code a while ago. Today I found out that the VTK 5 sources include
>> support for shaders. I have a remark on the vtkShaderProgram class. It
>> has funtions {Get,Set}{Vertex,Fragment}Shader() and it seems that per
>> shader program only one vertex and one fragment shader are supported.
>> I do not know about Cg, but in GLSL there is no such limit. For
>> example, a shader can be written with a function to do certain
>> lighting calculations and other shaders can then use this function. In
>> order to do this it needs to be possible to link more than one vertex
>> and one fragment shader to a shader program.
>>
>> Is there a reason for not having a more general
>> {Add,Remove}Shader(vtkShader*) function instead of the current get and
>> set methods for vertex and fragment shaders?
>>
>> Regards,
>> Tim.
>> _______________________________________________
>> vtk-developers mailing list
>> vtk-developers at vtk.org
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>>
> 
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
> 




More information about the vtk-developers mailing list