summaryrefslogtreecommitdiff
path: root/src/graphicsmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-16 23:58:02 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-16 23:58:02 +0300
commit8d3ef9075b56d9e9e8288e82e0242896433ff853 (patch)
tree0953a8c4538cc464d8f7a9de8b08389a4613f12b /src/graphicsmanager.cpp
parentf99ae9f63edfdd37a20cf53957861460be5e1116 (diff)
downloadmanaplus-8d3ef9075b56d9e9e8288e82e0242896433ff853.tar.gz
manaplus-8d3ef9075b56d9e9e8288e82e0242896433ff853.tar.bz2
manaplus-8d3ef9075b56d9e9e8288e82e0242896433ff853.tar.xz
manaplus-8d3ef9075b56d9e9e8288e82e0242896433ff853.zip
Add support for check is OpenGL ES present ot not. Also fix comparessions in nacl.
Diffstat (limited to 'src/graphicsmanager.cpp')
-rw-r--r--src/graphicsmanager.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index 7a6e97f1f..a5299ce1f 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -147,6 +147,7 @@ GraphicsManager::GraphicsManager() :
mTextureSampler(0),
mSupportDebug(0),
mSupportModernOpengl(false),
+ mGles(false),
#endif
mUseAtlases(false)
{
@@ -725,14 +726,16 @@ void GraphicsManager::updateTextureCompressionFormat() const
{
const int compressionFormat = config.getIntValue("compresstextures");
// using extensions if can
- if (checkGLVersion(3, 1) || supportExtension("GL_ARB_texture_compression"))
+ if (checkGLVersion(3, 1) ||
+ checkGLesVersion(2,0) ||
+ supportExtension("GL_ARB_texture_compression"))
{
GLint num = 0;
- glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num);
+ mglGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &num);
logger->log("support %d compressed formats", num);
GLint *const formats = new GLint[num > 10
? static_cast<size_t>(num) : 10];
- glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
+ mglGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats);
for (int f = 0; f < num; f ++)
logger->log(" 0x%x", static_cast<unsigned int>(formats[f]));
@@ -842,7 +845,8 @@ void GraphicsManager::setGLVersion()
{
mGlVersionString = getGLString(GL_VERSION);
std::string version = mGlVersionString;
- cutFirst(version, "OpenGL ES ");
+ if (findCutFirst(version, "OpenGL ES "))
+ mGles = true;
sscanf(version.c_str(), "%5d.%5d", &mMajor, &mMinor);
logger->log("Detected gl version: %d.%d", mMajor, mMinor);
mGlVendor = getGLString(GL_VENDOR);
@@ -874,6 +878,11 @@ bool GraphicsManager::checkSLVersion(const int major, const int minor) const
return mSLMajor > major || (mSLMajor == major && mSLMinor >= minor);
}
+bool GraphicsManager::checkGLesVersion(const int major, const int minor) const
+{
+ return mGles && (mMajor > major || (mMajor == major && mMinor >= minor));
+}
+
bool GraphicsManager::checkPlatformVersion(const int major,
const int minor) const
{