Fix the bug and prevent scripts switching to 3D if OpneGL is off.

Re #7538