Enable seamless filtering for cubemaps on OpenGL by default and add a new driver feature flag to disable it.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5661 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2018-11-20 15:47:13 +00:00
parent 7873503041
commit 05a05b75d1
4 changed files with 25 additions and 0 deletions

View File

@ -139,6 +139,9 @@ namespace video
//! Support for cube map textures.
EVDF_TEXTURE_CUBEMAP,
//! Support for filtering across different faces of the cubemap
EVDF_TEXTURE_CUBEMAP_SEAMLESS,
//! Only used for counting the elements of this enum
EVDF_COUNT
};

View File

@ -2022,6 +2022,19 @@ ITexture* COpenGLDriver::createDeviceDependentTextureCubemap(const io::path& nam
return texture;
}
void COpenGLDriver::disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag)
{
CNullDriver::disableFeature(feature, flag);
if ( feature == EVDF_TEXTURE_CUBEMAP_SEAMLESS )
{
if ( queryFeature(feature) )
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
else if (COpenGLExtensionHandler::queryFeature(feature))
glDisable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
}
}
//! Sets a material. All 3d drawing functions draw geometry now using this material.
void COpenGLDriver::setMaterial(const SMaterial& material)
{

View File

@ -131,6 +131,9 @@ namespace video
return FeatureEnabled[feature] && COpenGLExtensionHandler::queryFeature(feature);
}
//! Disable a feature of the driver.
virtual void disableFeature(E_VIDEO_DRIVER_FEATURE feature, bool flag=true) _IRR_OVERRIDE_;
//! Sets a material. All 3d drawing functions draw geometry now
//! using this material.
//! \param material: Material to be used from now on.

View File

@ -747,6 +747,10 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
os::Printer::log("Free render buffer memory (kB)", core::stringc(val[0]));
}
#endif
if (queryFeature(EVDF_TEXTURE_CUBEMAP_SEAMLESS))
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
#endif
}
@ -824,6 +828,8 @@ bool COpenGLExtensionHandler::queryFeature(E_VIDEO_DRIVER_FEATURE feature) const
return FeatureAvailable[IRR_EXT_texture_compression_s3tc];
case EVDF_TEXTURE_CUBEMAP:
return (Version >= 130) || FeatureAvailable[IRR_ARB_texture_cube_map] || FeatureAvailable[IRR_EXT_texture_cube_map];
case EVDF_TEXTURE_CUBEMAP_SEAMLESS:
return FeatureAvailable[IRR_ARB_seamless_cube_map];
default:
return false;
};