Godot version:
master
OS/device including version:
Any platform
Issue description:
It would be nice if it's possible to switch between GLES2 and GLES3 on runtime.
Currently this is only supported through the editor.
I request this feature because I don't want to export the game two times (one time for each renderer).
Recently it was made clear that GLES 2 shouldn't be used as fallback for GLES 3...?
@Zireael07 Some computers support GLES3 but are too slow to run 3d with high fps. So if there was a switch in game they would maybe have some issues with this renderer but over all the game becomes more fluently. The only issue would be that there should be .import files for etc and etc2 when it's possible to switch between both renderers.
What Zireael is saying is that GLES2 is not just a faster, simpler version of GLES3. Its a completely different backend. It is not designed so that you can switch a GLES3 project and have it work the same on lower-end hardware. Your project should be fully designed around using one or the other. Or, if you really want both, you should have two different versions.
@HugeGameArtGD if you want to expose such option to make the game faster, what you should switch is not the renderer, but the features, options and assets your game is using. Only then, you might be able to switch renderers, if that's even possible (or relevant). But it's not how it was intended to be used.
They're completelly diferent rendering engines, and some features like particles don't have GLES 2 versions.
You need to decide if you want to use all the new features and don't care about older pcs, or you really care about older pcs or mobile phones and use the GLES 2 renderer.
Is it still supported to use globals?
https://godotengine.org/qa/21575/how-you-change-project-settings-runtime-and-have-them-persist
I get the error that identifier 'Globals' is not declared in the current scope.
Is it possible with ProjectSettings.set(...) and ProjectSettings.save()?
@HugeGameArtGD You can start a given project with the --video-driver GLES2 or --video-driver GLES3 command-line argument to force a specific renderer, but this is not officially supported (except for the editor, but you should stick to one renderer per project).
As for overriding project settings that are read on project startup, in the Project Settings, set a path to a saved ConfigFile in Application -> Config -> Project Settings Override.
@Calinou Thank you, is it possible to call this with OS.execute? I've optimized the project for both renderers and except some water material everything looks the same.
@HugeGameArtGD Using a project settings override file is more portable than OS.execute(). Just make sure the override file uses a path of the form user://settings.ini (it needs to be on user://, otherwise it's not guaranteed to be writable to in an exported project).
@Calinou
ProjectSettings.set_setting("rendering/quality/driver/driver_name", "GLES2")
ProjectSettings.save()
This works for me. How can I save the setting to user://? Does this work for Android?
@HugeGameArtGD in exported games, project settings are baked into the executable/pck AFAIK, so that technique might work in your editor project (because it overwrites your project.godot) but not sure about the export.
I would advise using the ConfigFile class for this, as ProjectSettings.save() will save all project settings into a file (which is overkill for most purposes).
@Zylann It only worked in the export (one big project.godot file next to executable and .pck)
@Calinou Thank you, I will try it. Maybe it will also work on Android. https://docs.godotengine.org/en/latest/classes/class_configfile.html
@Calinou
How can I load the settings so it's switching to GLES2?
My code:
var config = ConfigFile.new()
var err = config.load("user://settings.cfg")
for section in _settings.keys():
for key in _settings[section].keys():
config.set_value(section, key, _settings[section][key])
config.save("user://settings.cfg")
and
var _settings = {
"rendering/quality": {
"driver/driver_name": ProjectSettings.get_setting("rendering/quality/driver/driver_name")
}
}
The config file:
[rendering/quality]
driver/driver_name="GLES2"
Doesn't work on HTML5. It would work if the config file was loaded from user:// (enable cookies in browser).
With https://github.com/Calinou/godot-settings-manager-demo I can switch between GLES2 and GLES3 on Linux, Windows and macOS. On Android it doesn't work (I enabled Write External Storage and Read External Storage in the export settings). On HTML5 last launch and player name works but the switch between GLES2 and GLES3 doesn't work. Thanks @Calinou for the nice demo.
Most helpful comment
What Zireael is saying is that GLES2 is not just a faster, simpler version of GLES3. Its a completely different backend. It is not designed so that you can switch a GLES3 project and have it work the same on lower-end hardware. Your project should be fully designed around using one or the other. Or, if you really want both, you should have two different versions.