How to apply render.setGLSLMaterialSetting to all scene?

So i make this Level 1 Scene with option menu Overlay that can enable/disable GLSL material setting like lights, shaders, and ramps using message Actuator from the Overlay Scene and sending it to message sensors of the Actual Scene (Level 1 and 2) and connect it to python Script.

At first it works for Level 1 but then when i switch the scene to Level 2 the setting is back to the default setting of the Scene (Level 2).

Example: I change the shaders in Level 1 from True to False and then when i move to Level 2 the shaders back to True. How do i fix this?

sorry for my bad english…

Ensure each level scene applies the current configuration at scene start (additional to the update when receiving the update message).

Alternative you can send the update message together with the scene switching.

Thanks for your reply…
How do i applies the current configuration to each scene?
and i never thought of sending the update message along with scene swicthing, i’ll try this now and tell you if this work… :slight_smile:

I’d use globalDict to tranfer a property for each of components(integer 1 = on, 0 = off)!

You know most programming languages have something like True/False to express on/off values ;).

Hmm… Your method was worked at first when i turn the lights shading off in Level 1 Scene it does effect in Level 2… but when i turn back the lights on in Level 1 or 2 it doesn’t effect the other Scenes.

Can i instead change/apply the GLSL Material Setting to whole game instead of per Scene? is it possible to do it in BGE?

Here’s my python script:

lights on:
import bge
rend = bge.render
rend.setGLSLMaterialSetting(“lights”, True)

lights off:
import bge
rend = bge.render
rend.setGLSLMaterialSetting(“lights”, False)

Additional Screenshot

0=lights off
1=lights on

It doesn’t effect even though the properties says 1!!


A property is just a storage.

You need to ensure you call the functions. Do this for each scene separately.

Sometimes booleans cause some problems for me:( I prefer integers!

Yes, i already try to make an empty object which contain python controllers that trigger the Shading on each scene separately and i’m pretty sure they call the script correctly but still no luck…

Can you give me a blend. file as example? on how it actually works, and thanks before

Nevermind, i just change the graphic options into 2d filter like bloom, ssao, and dof. And it’s working perfectly… But anyway thanks for your help :slight_smile: