|
|
@ -599,13 +599,10 @@ void CDriverGL3::bindTextureWithMode(ITexture &tex)
|
|
|
|
// system of "backup the previous binded texture" seems to not work with some drivers....
|
|
|
|
// system of "backup the previous binded texture" seems to not work with some drivers....
|
|
|
|
_DriverGLStates.activeTextureARB(0);
|
|
|
|
_DriverGLStates.activeTextureARB(0);
|
|
|
|
if (tex.isTextureCube())
|
|
|
|
if (tex.isTextureCube())
|
|
|
|
{
|
|
|
|
|
|
|
|
if (_Extensions.ARBTextureCubeMap)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_DriverGLStates.setTextureMode(CDriverGLStates3::TextureCubeMap);
|
|
|
|
_DriverGLStates.setTextureMode(CDriverGLStates3::TextureCubeMap);
|
|
|
|
// Bind this texture
|
|
|
|
// Bind this texture
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP, gltext->ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -636,17 +633,14 @@ void CDriverGL3::setupTextureBasicParameters(ITexture &tex)
|
|
|
|
gltext->MinFilter = tex.getMinFilter();
|
|
|
|
gltext->MinFilter = tex.getMinFilter();
|
|
|
|
if (tex.isTextureCube())
|
|
|
|
if (tex.isTextureCube())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_Extensions.ARBTextureCubeMap)
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
{
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_AnisotropicFilter > 1.f && gltext->MinFilter > ITexture::NearestMipMapLinear)
|
|
|
|
if (_AnisotropicFilter > 1.f && gltext->MinFilter > ITexture::NearestMipMapLinear)
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAX_ANISOTROPY_EXT, _AnisotropicFilter);
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, _AnisotropicFilter);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -669,9 +663,6 @@ bool CDriverGL3::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
|
|
|
|
//nldebug("3D: CDriverGL3::setupTextureEx(%016p, %d, %d, %d)", &tex, bUpload, bAllUploaded, bMustRecreateSharedTexture);
|
|
|
|
//nldebug("3D: CDriverGL3::setupTextureEx(%016p, %d, %d, %d)", &tex, bUpload, bAllUploaded, bMustRecreateSharedTexture);
|
|
|
|
bAllUploaded = false;
|
|
|
|
bAllUploaded = false;
|
|
|
|
|
|
|
|
|
|
|
|
if (tex.isTextureCube() && (!_Extensions.ARBTextureCubeMap))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 0. Create/Retrieve the driver texture.
|
|
|
|
// 0. Create/Retrieve the driver texture.
|
|
|
|
//=======================================
|
|
|
|
//=======================================
|
|
|
|
bool mustCreate = false;
|
|
|
|
bool mustCreate = false;
|
|
|
@ -1267,8 +1258,6 @@ bool CDriverGL3::activateTexture(uint stage, ITexture *tex)
|
|
|
|
// setup texture mode, after activeTextureARB()
|
|
|
|
// setup texture mode, after activeTextureARB()
|
|
|
|
_DriverGLStates.setTextureMode(CDriverGLStates3::TextureCubeMap);
|
|
|
|
_DriverGLStates.setTextureMode(CDriverGLStates3::TextureCubeMap);
|
|
|
|
|
|
|
|
|
|
|
|
if (_Extensions.ARBTextureCubeMap)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Activate texturing...
|
|
|
|
// Activate texturing...
|
|
|
|
//======================
|
|
|
|
//======================
|
|
|
|
|
|
|
|
|
|
|
@ -1279,20 +1268,19 @@ bool CDriverGL3::activateTexture(uint stage, ITexture *tex)
|
|
|
|
_CurrentTextureInfoGL[stage]= gltext;
|
|
|
|
_CurrentTextureInfoGL[stage]= gltext;
|
|
|
|
|
|
|
|
|
|
|
|
// setup this texture
|
|
|
|
// setup this texture
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP, gltext->ID);
|
|
|
|
|
|
|
|
|
|
|
|
// Change parameters of texture, if necessary.
|
|
|
|
// Change parameters of texture, if necessary.
|
|
|
|
//============================================
|
|
|
|
//============================================
|
|
|
|
if (gltext->MagFilter!= tex->getMagFilter())
|
|
|
|
if (gltext->MagFilter!= tex->getMagFilter())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gltext->MagFilter= tex->getMagFilter();
|
|
|
|
gltext->MagFilter= tex->getMagFilter();
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (gltext->MinFilter!= tex->getMinFilter())
|
|
|
|
if (gltext->MinFilter!= tex->getMinFilter())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gltext->MinFilter= tex->getMinFilter();
|
|
|
|
gltext->MinFilter= tex->getMinFilter();
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|