Commit c010d007 authored by hybrid's avatar hybrid

Fixed an OpenGL render state bug and added GLSL version number to check in extension handler.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@772 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 569d6d89
......@@ -274,6 +274,15 @@ bool COpenGLDriver::genericDriverInit(const core::dimension2d<s32>& screenSize,
CurrentTexture[i]=0;
// load extensions
initExtensions(stencilBuffer);
if (queryFeature(EVDF_ARB_GLSL))
{
char buf[32];
const u32 maj = ShaderLanguageVersion/100;
snprintf(buf, 32, "%u.%u", maj, ShaderLanguageVersion-maj*100);
os::Printer::log("GLSL version", buf, ELL_INFORMATION);
}
else
os::Printer::log("GLSL not available.", ELL_INFORMATION);
glViewport(0, 0, screenSize.Width, screenSize.Height); // Reset The Current Viewport
setAmbientLight(SColorf(0.0f,0.0f,0.0f,0.0f));
......@@ -1468,6 +1477,9 @@ void COpenGLDriver::setBasicRenderStates(const SMaterial& material, const SMater
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, mode);
}
}
// be sure to leave in texture stage 0
if (MultiTextureExtension)
extGlActiveTexture(GL_TEXTURE0_ARB);
}
......
......@@ -352,6 +352,19 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &MaxTextureUnits);
glGetIntegerv(GL_MAX_LIGHTS, &MaxLights);
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &MaxAnisotropy);
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &MaxIndices);
if (FeatureAvailable[IRR_ARB_shading_language_100])
{
glGetError(); // clean error buffer
const GLubyte* shaderVersion = glGetString(GL_SHADING_LANGUAGE_VERSION_ARB);
if (glGetError() == GL_INVALID_ENUM)
ShaderLanguageVersion = 100;
else
{
const f32 ver = core::fast_atof((c8*)shaderVersion);
ShaderLanguageVersion = core::floor32(ver)*100+core::ceil32((ver-floor(ver))*10.0);
}
}
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (!pGlActiveTextureARB || !pGlClientActiveTextureARB)
......@@ -367,7 +380,6 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
os::Printer::log("Warning: OpenGL device only has one texture unit. Disabling multitexturing.", ELL_WARNING);
}
MaxTextureUnits = core::min_((u32)MaxTextureUnits,MATERIAL_MAX_TEXTURES);
glGetIntegerv(GL_MAX_ELEMENTS_INDICES, &MaxIndices);
}
......
......@@ -655,7 +655,7 @@ class COpenGLExtensionHandler
//! queries the features of the driver, returns true if feature is available
bool queryFeature(E_VIDEO_DRIVER_FEATURE feature) const;
// show all features with availablity
//! show all features with availablity
void dump() const;
// Some variables for properties
......@@ -669,11 +669,18 @@ class COpenGLExtensionHandler
bool SeparateSpecularColorExtension;
// Some non-boolean properties
//! Maxmimum texture layers supported by the fixed pipeline
GLint MaxTextureUnits;
//! Maximum hardware lights supported
GLint MaxLights;
//! Optimal number of indices per meshbuffer
GLint MaxIndices;
//! Maximal Anisotropy
f32 MaxAnisotropy;
//! OpenGL version as Integer: 100*Major+Minor, i.e. 2.1 becomes 201
u32 Version;
//! GLSL version as Integer: 100*Major+Minor
u32 ShaderLanguageVersion;
// public access to the (loaded) extensions.
// 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