glsl object shader toggle issues

hey,

another question about glsl program, when one try to disable a previously setted shader :

sky/sun is made thanks to a lamp rig, controlled by python and some prop.
object shader is the simple red on the dome at the end of the vid.

I switch back to the blender material the objet is not enlighted as it was before the shader is applied : it seems the lights follow the camera transformations, and not the object transformations.

here the glsl toggle code I did :

[...]
mesh = ob.meshes[meshid]
mat = mesh.materials[matid]
matname = mesh.getMaterialName(matid)
shader = mat.getShader()
if shader != None:
	if not shader.isValid() :
		#doc says to use it before set but works without it ?
		#shader.delSource()
		shader.setSource(VertexShader, FragmentShader, 1) # this undocumented third arg (boolean it seems) seems to act as a set/unset toggle
		print('shader %s set on %s (%s)'%(shadername,matname,matid))
	else :
		shader.delSource()
		# this one works too
		#shader.setSource(VertexShader, FragmentShader, 0)
		print('shader %s not set on %s (%s)'%(shadername,matname,matid))
[...]

how can I retrieve the ‘normal’ enlightment setup ?

You can delete the schader with delSource().
http://www.tutorialsforblender3d.com/GameModule/ClassBL_Shader_1.html

Examples:
XRay 2.5x.blend (340 KB)
XRay 2.6x.blend (348 KB)

Description of setSource third parameter. http://www.tutorialsforblender3d.com/GameModule/ClassBL_Shader_8.html

I already use delSource() as shown above, but thanks.

here is your blend with the problem inside.
http://www.pasteall.org/blend/14161
blender 2.63 32bits windows 45966

this is glsl mode specific, it looks ok in multitex.

also the thing below is odd :
try to uncomment line 43, a simple getShader() call suffice to break the material animation (still in glsl.)

Ok now I see what you mean. I think there’s a bug in glsl mode with getSchader() function.
It seems to be a really old bug, because I thestet it down to Blender 2.49b with the same result.