Commit 662e2dc2 authored by hybrid's avatar hybrid

Reduce size of OpenGL extension handler.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2075 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 7b1de5cf
...@@ -21,7 +21,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : ...@@ -21,7 +21,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
MultiTextureExtension(false), MultiSamplingExtension(false), MultiTextureExtension(false), MultiSamplingExtension(false),
TextureCompressionExtension(false), TextureCompressionExtension(false),
MaxTextureUnits(1), MaxLights(1), MaxIndices(65535), MaxTextureUnits(1), MaxLights(1), MaxIndices(65535),
MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAnisotropy(1), MaxUserClipPlanes(0), MaxAuxBuffers(0),
Version(0), ShaderLanguageVersion(0) Version(0), ShaderLanguageVersion(0)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0), ,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
...@@ -66,7 +66,7 @@ void COpenGLExtensionHandler::dump() const ...@@ -66,7 +66,7 @@ void COpenGLExtensionHandler::dump() const
void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
{ {
const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION))); const f32 ogl_ver = core::fast_atof(reinterpret_cast<const c8*>(glGetString(GL_VERSION)));
Version = core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f); Version = static_cast<u16>(core::floor32(ogl_ver)*100+core::round32(core::fract(ogl_ver)*10.0f));
if ( Version >= 102) if ( Version >= 102)
os::Printer::log("OpenGL driver version is 1.2 or better.", ELL_INFORMATION); os::Printer::log("OpenGL driver version is 1.2 or better.", ELL_INFORMATION);
else else
...@@ -388,27 +388,33 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -388,27 +388,33 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
#endif // _IRR_OPENGL_USE_EXTPOINTER_ #endif // _IRR_OPENGL_USE_EXTPOINTER_
#endif // _IRR_WINDOWS_API_ #endif // _IRR_WINDOWS_API_
GLint num;
// set some properties // set some properties
#if defined(GL_ARB_multitexture) || defined(GL_VERSION_1_3) #if defined(GL_ARB_multitexture) || defined(GL_VERSION_1_3)
if (Version>102 || FeatureAvailable[IRR_ARB_multitexture]) if (Version>102 || FeatureAvailable[IRR_ARB_multitexture])
{ {
GLint num;
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &num); glGetIntegerv(GL_MAX_TEXTURE_UNITS, &num);
MaxTextureUnits=num; MaxTextureUnits=static_cast<u8>(num);
} }
#endif #endif
glGetIntegerv(GL_MAX_LIGHTS, &MaxLights); glGetIntegerv(GL_MAX_LIGHTS, &num);
MaxLights=static_cast<u8>(num);
#ifdef GL_EXT_texture_filter_anisotropic #ifdef GL_EXT_texture_filter_anisotropic
GLint maxAniso=1; // temporary for size adaption
if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic]) if (FeatureAvailable[IRR_EXT_texture_filter_anisotropic])
glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAniso); glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &num);
MaxAnisotropy=(u8)maxAniso; MaxAnisotropy=static_cast<u8>(num);
#endif #endif
#ifdef GL_VERSION_1_2 #ifdef GL_VERSION_1_2
if (Version>101) if (Version>101)
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &MaxIndices); {
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &num);
MaxIndices=num;
}
#endif #endif
glGetIntegerv(GL_MAX_CLIP_PLANES, reinterpret_cast<GLint*>(&MaxUserClipPlanes)); glGetIntegerv(GL_MAX_CLIP_PLANES, &num);
MaxUserClipPlanes=static_cast<u8>(num);
glGetIntegerv(GL_AUX_BUFFERS, &num);
MaxAuxBuffers=static_cast<u8>(num);
#if defined(GL_ARB_shading_language_100) || defined (GL_VERSION_2_0) #if defined(GL_ARB_shading_language_100) || defined (GL_VERSION_2_0)
if (FeatureAvailable[IRR_ARB_shading_language_100] || Version>=200) if (FeatureAvailable[IRR_ARB_shading_language_100] || Version>=200)
{ {
...@@ -423,7 +429,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -423,7 +429,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
else else
{ {
const f32 sl_ver = core::fast_atof(reinterpret_cast<const c8*>(shaderVersion)); const f32 sl_ver = core::fast_atof(reinterpret_cast<const c8*>(shaderVersion));
ShaderLanguageVersion = core::floor32(sl_ver)*100+core::round32(core::fract(sl_ver)*10.0f); ShaderLanguageVersion = static_cast<u16>(core::floor32(sl_ver)*100+core::round32(core::fract(sl_ver)*10.0f));
} }
} }
#endif #endif
...@@ -441,7 +447,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -441,7 +447,7 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
MultiTextureExtension = false; MultiTextureExtension = false;
os::Printer::log("Warning: OpenGL device only has one texture unit. Disabling multitexturing.", ELL_WARNING); os::Printer::log("Warning: OpenGL device only has one texture unit. Disabling multitexturing.", ELL_WARNING);
} }
MaxTextureUnits = core::min_(MaxTextureUnits,MATERIAL_MAX_TEXTURES); MaxTextureUnits = core::min_(MaxTextureUnits,static_cast<u8>(MATERIAL_MAX_TEXTURES));
} }
......
...@@ -713,20 +713,22 @@ class COpenGLExtensionHandler ...@@ -713,20 +713,22 @@ class COpenGLExtensionHandler
// Some non-boolean properties // Some non-boolean properties
//! Maxmimum texture layers supported by the fixed pipeline //! Maxmimum texture layers supported by the fixed pipeline
u32 MaxTextureUnits; u8 MaxTextureUnits;
//! Maximum hardware lights supported //! Maximum hardware lights supported
GLint MaxLights; u8 MaxLights;
//! Optimal number of indices per meshbuffer //! Optimal number of indices per meshbuffer
GLint MaxIndices; u32 MaxIndices;
//! Maximal Anisotropy //! Maximal Anisotropy
u8 MaxAnisotropy; u8 MaxAnisotropy;
//! Number of user clipplanes //! Number of user clipplanes
u32 MaxUserClipPlanes; u8 MaxUserClipPlanes;
//! Number of auxiliary buffers
u8 MaxAuxBuffers;
//! OpenGL version as Integer: 100*Major+Minor, i.e. 2.1 becomes 201 //! OpenGL version as Integer: 100*Major+Minor, i.e. 2.1 becomes 201
u32 Version; u16 Version;
//! GLSL version as Integer: 100*Major+Minor //! GLSL version as Integer: 100*Major+Minor
u32 ShaderLanguageVersion; u16 ShaderLanguageVersion;
// public access to the (loaded) extensions. // public access to the (loaded) extensions.
// general functions // general functions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment