Commit 3e71d976 authored by hybrid's avatar hybrid

Make use of new mipmap extension in case the card supports it. Patch also by Nadro.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4050 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b601dede
...@@ -2264,7 +2264,6 @@ inline void COpenGLExtensionHandler::extGlEnableIndexed(GLenum target, GLuint in ...@@ -2264,7 +2264,6 @@ inline void COpenGLExtensionHandler::extGlEnableIndexed(GLenum target, GLuint in
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlDisableIndexed(GLenum target, GLuint index) inline void COpenGLExtensionHandler::extGlDisableIndexed(GLenum target, GLuint index)
{ {
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
...@@ -2277,7 +2276,6 @@ inline void COpenGLExtensionHandler::extGlDisableIndexed(GLenum target, GLuint i ...@@ -2277,7 +2276,6 @@ inline void COpenGLExtensionHandler::extGlDisableIndexed(GLenum target, GLuint i
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst) inline void COpenGLExtensionHandler::extGlBlendFuncIndexed(GLuint buf, GLenum src, GLenum dst)
{ {
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
...@@ -2294,7 +2292,6 @@ inline void COpenGLExtensionHandler::extGlBlendFuncIndexed(GLuint buf, GLenum sr ...@@ -2294,7 +2292,6 @@ inline void COpenGLExtensionHandler::extGlBlendFuncIndexed(GLuint buf, GLenum sr
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlBlendEquationIndexed(GLuint buf, GLenum mode) inline void COpenGLExtensionHandler::extGlBlendEquationIndexed(GLuint buf, GLenum mode)
{ {
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
...@@ -2311,7 +2308,6 @@ inline void COpenGLExtensionHandler::extGlBlendEquationIndexed(GLuint buf, GLenu ...@@ -2311,7 +2308,6 @@ inline void COpenGLExtensionHandler::extGlBlendEquationIndexed(GLuint buf, GLenu
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program, GLenum pname, GLint value) inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program, GLenum pname, GLint value)
{ {
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
...@@ -2333,7 +2329,6 @@ inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program, ...@@ -2333,7 +2329,6 @@ inline void COpenGLExtensionHandler::extGlProgramParameteri(GLhandleARB program,
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlGenQueries(GLsizei n, GLuint *ids) inline void COpenGLExtensionHandler::extGlGenQueries(GLsizei n, GLuint *ids)
{ {
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
...@@ -2350,7 +2345,6 @@ inline void COpenGLExtensionHandler::extGlGenQueries(GLsizei n, GLuint *ids) ...@@ -2350,7 +2345,6 @@ inline void COpenGLExtensionHandler::extGlGenQueries(GLsizei n, GLuint *ids)
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlDeleteQueries(GLsizei n, const GLuint *ids) inline void COpenGLExtensionHandler::extGlDeleteQueries(GLsizei n, const GLuint *ids)
{ {
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
......
...@@ -314,6 +314,8 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -314,6 +314,8 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
if (Driver->testGLError()) if (Driver->testGLError())
os::Printer::log("Could not bind Texture", ELL_ERROR); os::Printer::log("Could not bind Texture", ELL_ERROR);
bool mipmapLegacyMode = true;
// mipmap handling for main texture // mipmap handling for main texture
if (!level && newTexture) if (!level && newTexture)
{ {
...@@ -321,6 +323,8 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -321,6 +323,8 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
#ifdef GL_SGIS_generate_mipmap #ifdef GL_SGIS_generate_mipmap
// auto generate if possible and no mipmap data is given // auto generate if possible and no mipmap data is given
if (HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE)) if (HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE))
{
if(!Driver->queryFeature(EVDF_FRAMEBUFFER_OBJECT))
{ {
if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED)) if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED))
glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST); glHint(GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST);
...@@ -333,6 +337,9 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -333,6 +337,9 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
AutomaticMipmapUpdate=true; AutomaticMipmapUpdate=true;
} }
else else
mipmapLegacyMode = false;
}
else
#endif #endif
{ {
// Either generate manually due to missing capability // Either generate manually due to missing capability
...@@ -368,6 +375,17 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level) ...@@ -368,6 +375,17 @@ void COpenGLTexture::uploadTexture(bool newTexture, void* mipmapData, u32 level)
image->getDimension().Height, PixelFormat, PixelType, source); image->getDimension().Height, PixelFormat, PixelType, source);
image->unlock(); image->unlock();
if (!mipmapLegacyMode)
{
glEnable(GL_TEXTURE_2D);
Driver->extGlGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
AutomaticMipmapUpdate=true;
}
if (Driver->testGLError()) if (Driver->testGLError())
os::Printer::log("Could not glTexImage2D", ELL_ERROR); os::Printer::log("Could not glTexImage2D", ELL_ERROR);
} }
......
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