From f5ff378dd02431cdcf658b210509b170ea2135d1 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 19 Feb 2011 11:48:54 +0200 Subject: [PATCH] video backend selection --- minetest.conf.example | 27 ++++++++++++++++++++------- src/defaultsettings.cpp | 1 + src/main.cpp | 37 ++++++++++++++++++++++++------------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/minetest.conf.example b/minetest.conf.example index edf43e889..eb17ebc74 100644 --- a/minetest.conf.example +++ b/minetest.conf.example @@ -7,7 +7,9 @@ # By default, all the settings are commented and not functional. # Uncomment settings by removing the preceding #. +# # Client side stuff +# #wanted_fps = 30 #fps_max = 60 @@ -19,17 +21,28 @@ #address = kray.dy.fi #name = +# Whether to try to fog out the border of the visible area +#enable_fog = true +# Enable a bit lower water surface; disable for speed +#new_style_water = true +# Enable nice leaves; disable for speed +#new_style_leaves = true +# Whether to draw a frametime graph +#frametime_graph = false +# Enable combining mainly used textures to a bigger one +#enable_texture_atlas = true +# Path to texture directory +#texture_path = +# Possible values: null, software, burningsvideo, direct3d8, direct3d9, opengl +#video_driver = opengl + +# #random_input = false #client_delete_unused_sectors_timeout = 1200 -#enable_fog = true -#new_style_water = true -#new_style_leaves = true -#frametime_graph = false -#enable_texture_atlas = true -#texture_path = - +# # Server side stuff +# #map-dir = /home/palle/custom_map diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 72f63d9fb..a456a4fce 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -44,6 +44,7 @@ void set_default_settings() g_settings.setDefault("frametime_graph", "false"); g_settings.setDefault("enable_texture_atlas", "true"); g_settings.setDefault("texture_path", ""); + g_settings.setDefault("video_driver", "opengl"); g_settings.setDefault("free_move", "false"); g_settings.setDefault("continuous_forward", "false"); diff --git a/src/main.cpp b/src/main.cpp index 11ae9985c..2754c324b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1723,30 +1723,41 @@ int main(int argc, char *argv[]) std::string playername = g_settings.get("name"); - /* - Resolution selection - */ + // Resolution selection bool fullscreen = false; u16 screenW = g_settings.getU16("screenW"); u16 screenH = g_settings.getU16("screenH"); - // - - MyEventReceiver receiver; + // Determine driver video::E_DRIVER_TYPE driverType; + + std::string driverstring = g_settings.get("video_driver"); -#ifdef _WIN32 - //driverType = video::EDT_DIRECT3D9; - driverType = video::EDT_OPENGL; -#else - driverType = video::EDT_OPENGL; - //driverType = video::EDT_BURNINGSVIDEO; // Best software renderer -#endif + if(driverstring == "null") + driverType = video::EDT_NULL; + else if(driverstring == "software") + driverType = video::EDT_SOFTWARE; + else if(driverstring == "burningsvideo") + driverType = video::EDT_BURNINGSVIDEO; + else if(driverstring == "direct3d8") + driverType = video::EDT_DIRECT3D8; + else if(driverstring == "direct3d9") + driverType = video::EDT_DIRECT3D9; + else if(driverstring == "opengl") + driverType = video::EDT_OPENGL; + else + { + dstream<<"WARNING: Invalid video_driver specified; defaulting " + "to opengl"<(screenW, screenH),