|
@@ -38,6 +38,7 @@ namespace opengl
|
|
OpenGL::OpenGL()
|
|
OpenGL::OpenGL()
|
|
: contextInitialized(false)
|
|
: contextInitialized(false)
|
|
, maxAnisotropy(1.0f)
|
|
, maxAnisotropy(1.0f)
|
|
|
|
+ , maxTextureSize(0)
|
|
, state()
|
|
, state()
|
|
{
|
|
{
|
|
}
|
|
}
|
|
@@ -103,12 +104,7 @@ void OpenGL::initContext()
|
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *) &state.textureUnits[0]);
|
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *) &state.textureUnits[0]);
|
|
}
|
|
}
|
|
|
|
|
|
- // We'll need this value to clamp anisotropy.
|
|
|
|
- if (GLEE_EXT_texture_filter_anisotropic)
|
|
|
|
- glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
|
|
|
|
- else
|
|
|
|
- maxAnisotropy = 1.0f;
|
|
|
|
-
|
|
|
|
|
|
+ initMaxValues();
|
|
createDefaultTexture();
|
|
createDefaultTexture();
|
|
|
|
|
|
contextInitialized = true;
|
|
contextInitialized = true;
|
|
@@ -151,6 +147,17 @@ void OpenGL::initOpenGLFunctions()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void OpenGL::initMaxValues()
|
|
|
|
+{
|
|
|
|
+ // We'll need this value to clamp anisotropy.
|
|
|
|
+ if (GLEE_EXT_texture_filter_anisotropic)
|
|
|
|
+ glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropy);
|
|
|
|
+ else
|
|
|
|
+ maxAnisotropy = 1.0f;
|
|
|
|
+
|
|
|
|
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
|
|
|
|
+}
|
|
|
|
+
|
|
void OpenGL::createDefaultTexture()
|
|
void OpenGL::createDefaultTexture()
|
|
{
|
|
{
|
|
// Set the 'default' texture (id 0) as a repeating white pixel. Otherwise,
|
|
// Set the 'default' texture (id 0) as a repeating white pixel. Otherwise,
|
|
@@ -449,6 +456,11 @@ graphics::Image::Wrap OpenGL::getTextureWrap()
|
|
return w;
|
|
return w;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int OpenGL::getMaxTextureSize() const
|
|
|
|
+{
|
|
|
|
+ return maxTextureSize;
|
|
|
|
+}
|
|
|
|
+
|
|
// OpenGL class instance singleton.
|
|
// OpenGL class instance singleton.
|
|
OpenGL gl;
|
|
OpenGL gl;
|
|
|
|
|