[vtk-developers] vtkGLSLShaderStuff

John Biddiscombe biddisco at cscs.ch
Tue Nov 29 05:04:50 EST 2005


The vtkGLSLShader and vtkGLSLShaderProgram code use OpenGL2 calls to do 
their stuff. However, OpenGL1.5+extensions is adequate for many GLSL 
programs. I've altered the code so that it will use extensions if 
available but I have a question...

Currently, I've modified vtkGLSLShaderProgram, vtkGLSLShader so that all 
calls to vtkgl::CreateProgram(...) are replaced with something like
if (GL2Supported())
    vtkgl::CreateProgram(...)
}
else {
    vtkgl::CreateProgramARB(...)
}

with all the GL2 calls replaced by equivalent functionality for 
GL1.5+ext, however I don't like it because it's untidy and I'd much 
rather create new classes like vtkGL15ShaderProgram & vtkGL15Shader 
which will simply be implementations using the extension code.

The trouble is that the vtkGLSLShaderXXX classes are instantiated inside 
vtkShaderProgram:::CreateShaderProgram and the vtkShaderProgram only 
knows if OpenGL2 is available (or which extensions are available) when a 
rendering context is ready and this happens when the property first 
calls "render". Unfortunately, by this time the 
Cg/GLSL/XXXX/shaderprograms have been created and so it's too late to 
instantiate an extension specific class.

I'd like to keep the GLSL code clean and have an extension specific 
class. Some kind of proxy maybe. Would anyone like to make a suggestion.

thanks

JB
PS. Kitware people, please may I have cvs write access back.

-- 
John Biddiscombe,                            email:biddisco @ cscs.ch
http://www.cscs.ch/about/BJohn.php
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82





More information about the vtk-developers mailing list