diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2013-03-10 15:44:21 +0100 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2013-03-10 15:44:21 +0100 |
commit | bc859c4c597f106d40f07380bf255f180d565577 (patch) | |
tree | 177b7a904a128341f033251fd6a7011fa5644439 /src/graphics | |
parent | 1f565fdf389542eb0296bf7f685716200c559538 (diff) | |
download | colobot-bc859c4c597f106d40f07380bf255f180d565577.tar.gz colobot-bc859c4c597f106d40f07380bf255f180d565577.tar.bz2 colobot-bc859c4c597f106d40f07380bf255f180d565577.zip |
VBO override option; argv parsing using getopt
* added -vbo option to override autodetection of OpenGL VBO extension
* refactored argument parsing to use getopt()
* fixed failing UTs
Diffstat (limited to 'src/graphics')
-rw-r--r-- | src/graphics/opengl/gldevice.cpp | 25 | ||||
-rw-r--r-- | src/graphics/opengl/gldevice.h | 14 |
2 files changed, 35 insertions, 4 deletions
diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 80fa9a1..beeb85e 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -51,6 +51,8 @@ void GLDeviceConfig::LoadDefault() greenSize = 8; alphaSize = 8; depthSize = 24; + + vboMode = VBO_MODE_AUTO; } @@ -99,11 +101,26 @@ bool CGLDevice::Create() if (!m_multitextureAvailable) GetLogger()->Warn("GLEW reports multitexturing not supported - graphics quality will be degraded!\n"); - m_vboAvailable = glewIsSupported("GL_ARB_vertex_buffer_object"); - if (m_vboAvailable) - GetLogger()->Info("Detected ARB_vertex_buffer_object extension - using VBOs\n"); + if (m_config.vboMode == VBO_MODE_ENABLE) + { + GetLogger()->Info("VBO enabled by override - using VBOs\n"); + m_vboAvailable = true; + } + else if (m_config.vboMode == VBO_MODE_DISABLE) + { + GetLogger()->Info("VBO disabled by override - using display lists\n"); + m_vboAvailable = false; + } else - GetLogger()->Info("No ARB_vertex_buffer_object extension present - using display lists\n"); + { + GetLogger()->Info("Auto-detecting VBO support\n"); + m_vboAvailable = glewIsSupported("GL_ARB_vertex_buffer_object"); + + if (m_vboAvailable) + GetLogger()->Info("Detected ARB_vertex_buffer_object extension - using VBOs\n"); + else + GetLogger()->Info("No ARB_vertex_buffer_object extension present - using display lists\n"); + } } // This is mostly done in all modern hardware by default diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index 7137671..fe3f2a1 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -34,6 +34,17 @@ namespace Gfx { /** + \enum VBOMode + \brief VBO autodetect/override + */ +enum VBOMode +{ + VBO_MODE_ENABLE, //! < override: enable + VBO_MODE_DISABLE, //! < override: disable + VBO_MODE_AUTO //! < autodetect +}; + +/** \struct GLDeviceConfig \brief Additional config with OpenGL-specific settings */ struct GLDeviceConfig : public DeviceConfig @@ -52,6 +63,9 @@ struct GLDeviceConfig : public DeviceConfig //! Force hardware acceleration (video mode set will fail on lack of hw accel) bool hardwareAccel; + //! VBO override/autodetect + VBOMode vboMode; + //! Constructor calls LoadDefaults() GLDeviceConfig(); |