GL3: Remove GL_ARB_texture_cube_map

--HG--
branch : opengl3
hg/feature/opengl3
kaetemi 11 years ago
parent 441d3a66f5
commit 0802330985

@ -409,7 +409,7 @@ bool CDriverGL3::setupDisplay()
_UserLightEnable[i]= false; _UserLightEnable[i]= false;
// init _DriverGLStates // init _DriverGLStates
_DriverGLStates.init(_Extensions.ARBTextureCubeMap, (_Extensions.NVTextureRectangle || _Extensions.EXTTextureRectangle || _Extensions.ARBTextureRectangle), _MaxDriverLight); _DriverGLStates.init((_Extensions.NVTextureRectangle || _Extensions.EXTTextureRectangle || _Extensions.ARBTextureRectangle), _MaxDriverLight);
// Init OpenGL/Driver defaults. // Init OpenGL/Driver defaults.
//============================= //=============================
@ -999,11 +999,8 @@ void CDriverGL3::copyFrameBufferToTexture(ITexture *tex,
_DriverGLStates.setTextureMode(textureMode); _DriverGLStates.setTextureMode(textureMode);
if (tex->isTextureCube()) if (tex->isTextureCube())
{ {
if (_Extensions.ARBTextureCubeMap) glBindTexture(GL_TEXTURE_CUBE_MAP, gltext->ID);
{ glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
glCopyTexSubImage2D(NLCubeFaceToGLCubeFace[cubeFace], level, offsetx, offsety, x, y, width, height);
}
} }
else else
{ {
@ -1631,7 +1628,7 @@ void CDriverGL3::checkTextureOn() const
GLboolean flagCM; GLboolean flagCM;
GLboolean flagTR; GLboolean flagTR;
glGetBooleanv(GL_TEXTURE_2D, &flag2D); glGetBooleanv(GL_TEXTURE_2D, &flag2D);
glGetBooleanv(GL_TEXTURE_CUBE_MAP_ARB, &flagCM); glGetBooleanv(GL_TEXTURE_CUBE_MAP, &flagCM);
glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR); glGetBooleanv(GL_TEXTURE_RECTANGLE_NV, &flagTR);

@ -519,16 +519,6 @@ static bool setupEXTTextureCompressionS3TC(const char *glext)
return true; return true;
} }
// *********************************
static bool setupARBTextureCubeMap(const char *glext)
{
H_AUTO_OGL(setupARBTextureCubeMap);
CHECK_EXT("GL_ARB_texture_cube_map");
return true;
}
// ********************************* // *********************************
static bool setupEXTSecondaryColor(const char *glext) static bool setupEXTSecondaryColor(const char *glext)
{ {
@ -878,9 +868,6 @@ void registerGlExtensions(CGlExtensions &ext)
// Check ARBMultisample // Check ARBMultisample
ext.ARBMultisample = setupARBMultisample(glext); ext.ARBMultisample = setupARBMultisample(glext);
// Check for cube mapping
ext.ARBTextureCubeMap = setupARBTextureCubeMap(glext);
// Check EXTSecondaryColor // Check EXTSecondaryColor
ext.EXTSecondaryColor= setupEXTSecondaryColor(glext); ext.EXTSecondaryColor= setupEXTSecondaryColor(glext);

@ -49,7 +49,6 @@ struct CGlExtensions
uint NbTextureStages; uint NbTextureStages;
// Optional Extensions. (old) // Optional Extensions. (old)
bool ARBTextureCubeMap;
bool NVTextureRectangle; bool NVTextureRectangle;
bool EXTTextureRectangle; bool EXTTextureRectangle;
bool ARBTextureRectangle; bool ARBTextureRectangle;
@ -74,7 +73,6 @@ public:
ARBMultiTexture= false; ARBMultiTexture= false;
NbTextureStages= 1; NbTextureStages= 1;
EXTTextureCompressionS3TC= false; EXTTextureCompressionS3TC= false;
ARBTextureCubeMap= false;
EXTSecondaryColor= false; EXTSecondaryColor= false;
WGLARBPBuffer= false; WGLARBPBuffer= false;
WGLARBPixelFormat= false; WGLARBPixelFormat= false;
@ -100,7 +98,6 @@ public:
result += "\n Texturing: "; result += "\n Texturing: ";
result += ARBMultiTexture ? "ARBMultiTexture " : ""; result += ARBMultiTexture ? "ARBMultiTexture " : "";
result += EXTTextureCompressionS3TC ? "EXTTextureCompressionS3TC " : ""; result += EXTTextureCompressionS3TC ? "EXTTextureCompressionS3TC " : "";
result += ARBTextureCubeMap ? "ARBTextureCubeMap " : "";
result += NVTextureRectangle ? "NVTextureRectangle " : ""; result += NVTextureRectangle ? "NVTextureRectangle " : "";
result += EXTTextureRectangle ? "EXTTextureRectangle " : ""; result += EXTTextureRectangle ? "EXTTextureRectangle " : "";
result += ARBTextureRectangle ? "ARBTextureRectangle " : ""; result += ARBTextureRectangle ? "ARBTextureRectangle " : "";

@ -94,7 +94,7 @@ static inline void convTexAddr(ITexture *tex, CMaterial::TTexAddressingMode mode
static const GLenum glTexCubeAddrModesNV[] = static const GLenum glTexCubeAddrModesNV[] =
{ {
GL_NONE, GL_TEXTURE_CUBE_MAP_ARB, GL_NONE, GL_TEXTURE_CUBE_MAP,
GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV, GL_PASS_THROUGH_NV, GL_CULL_FRAGMENT_NV,
GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV, GL_OFFSET_TEXTURE_2D_NV, GL_OFFSET_TEXTURE_2D_SCALE_NV,
GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV, GL_DEPENDENT_AR_TEXTURE_2D_NV, GL_DEPENDENT_GB_TEXTURE_2D_NV,
@ -1124,9 +1124,6 @@ sint CDriverGL3::beginSpecularMultiPass()
// Manage the rare case when the SpecularMap is not provided (fault of graphist). // Manage the rare case when the SpecularMap is not provided (fault of graphist).
if (mat.getTexture(1)==NULL) if (mat.getTexture(1)==NULL)
return 1; return 1;
if (!_Extensions.ARBTextureCubeMap)
return 1;
return 1; return 1;
} }

@ -32,7 +32,6 @@ namespace NLDRIVERGL3 {
CDriverGLStates3::CDriverGLStates3() CDriverGLStates3::CDriverGLStates3()
{ {
H_AUTO_OGL(CDriverGLStates3_CDriverGLStates) H_AUTO_OGL(CDriverGLStates3_CDriverGLStates)
_TextureCubeMapSupported= false;
_CurrARBVertexBuffer = 0; _CurrARBVertexBuffer = 0;
_DepthRangeNear = 0.f; _DepthRangeNear = 0.f;
_DepthRangeFar = 1.f; _DepthRangeFar = 1.f;
@ -43,10 +42,9 @@ CDriverGLStates3::CDriverGLStates3()
// *************************************************************************** // ***************************************************************************
void CDriverGLStates3::init(bool supportTextureCubeMap, bool supportTextureRectangle, uint maxLight) void CDriverGLStates3::init(bool supportTextureRectangle, uint maxLight)
{ {
H_AUTO_OGL(CDriverGLStates3_init) H_AUTO_OGL(CDriverGLStates3_init)
_TextureCubeMapSupported= supportTextureCubeMap;
_TextureRectangleSupported= supportTextureRectangle; _TextureRectangleSupported= supportTextureRectangle;
_MaxDriverLight= maxLight; _MaxDriverLight= maxLight;
_MaxDriverLight= std::min(_MaxDriverLight, uint(MaxLight)); _MaxDriverLight= std::min(_MaxDriverLight, uint(MaxLight));
@ -146,8 +144,7 @@ void CDriverGLStates3::forceDefaults(uint nbStages)
nglActiveTextureARB(GL_TEXTURE0_ARB+stage); nglActiveTextureARB(GL_TEXTURE0_ARB+stage);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
if (_TextureCubeMapSupported) glDisable(GL_TEXTURE_CUBE_MAP);
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
_TextureMode[stage]= TextureDisabled; _TextureMode[stage]= TextureDisabled;

@ -36,7 +36,7 @@ namespace NLDRIVERGL3 {
- GL_ALPHA_TEST - GL_ALPHA_TEST
- GL_LIGHTING - GL_LIGHTING
- GL_LIGHT0 + i ..... - GL_LIGHT0 + i .....
- GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_ARB/OES. - GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP/OES.
- GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R - GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R
- GL_COLOR_MATERIAL - GL_COLOR_MATERIAL
- GL_FOG - GL_FOG
@ -74,7 +74,7 @@ public:
/// Constructor. no-op. /// Constructor. no-op.
CDriverGLStates3(); CDriverGLStates3();
// init. Do it just after setDisplay() // init. Do it just after setDisplay()
void init(bool supportTextureCubeMap, bool supportTextureRectangle, uint maxLight); void init(bool supportTextureRectangle, uint maxLight);
/// Reset all OpenGL states of interest to default, and update caching. This don't apply to light. /// Reset all OpenGL states of interest to default, and update caching. This don't apply to light.
void forceDefaults(uint nbTextureStages); void forceDefaults(uint nbTextureStages);
@ -195,7 +195,6 @@ private:
float _CurShininess; float _CurShininess;
bool _VertexColorLighted; bool _VertexColorLighted;
bool _TextureCubeMapSupported;
bool _TextureRectangleSupported; bool _TextureRectangleSupported;
uint _CurrentActiveTextureARB; uint _CurrentActiveTextureARB;
TTextureMode _TextureMode[8]; TTextureMode _TextureMode[8];

@ -600,12 +600,9 @@ void CDriverGL3::bindTextureWithMode(ITexture &tex)
_DriverGLStates.activeTextureARB(0); _DriverGLStates.activeTextureARB(0);
if (tex.isTextureCube()) if (tex.isTextureCube())
{ {
if (_Extensions.ARBTextureCubeMap) _DriverGLStates.setTextureMode(CDriverGLStates3::TextureCubeMap);
{ // Bind this texture
_DriverGLStates.setTextureMode(CDriverGLStates3::TextureCubeMap); glBindTexture(GL_TEXTURE_CUBE_MAP, gltext->ID);
// Bind this texture
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
}
} }
else else
{ {
@ -627,26 +624,23 @@ void CDriverGL3::bindTextureWithMode(ITexture &tex)
void CDriverGL3::setupTextureBasicParameters(ITexture &tex) void CDriverGL3::setupTextureBasicParameters(ITexture &tex)
{ {
CTextureDrvInfosGL3* gltext; CTextureDrvInfosGL3* gltext;
gltext= getTextureGl(tex); gltext = getTextureGl(tex);
// TODO: possible cache here, but beware, this is called just after texture creation as well, so these fields // TODO: possible cache here, but beware, this is called just after texture creation as well, so these fields
// haven't ever been filled. // haven't ever been filled.
gltext->WrapS= tex.getWrapS(); gltext->WrapS = tex.getWrapS();
gltext->WrapT= tex.getWrapT(); gltext->WrapT = tex.getWrapT();
gltext->MagFilter= tex.getMagFilter(); gltext->MagFilter = tex.getMagFilter();
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)
glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAX_ANISOTROPY_EXT, _AnisotropicFilter);
if (_AnisotropicFilter > 1.f && gltext->MinFilter > ITexture::NearestMipMapLinear)
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, 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;
@ -679,9 +670,9 @@ bool CDriverGL3::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
{ {
//nldebug("3D: creating CTextureDrvShare()"); //nldebug("3D: creating CTextureDrvShare()");
// insert into driver list. (so it is deleted when driver is deleted). // insert into driver list. (so it is deleted when driver is deleted).
ItTexDrvSharePtrList it= _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL); ItTexDrvSharePtrList it = _TexDrvShares.insert(_TexDrvShares.end(), (NL3D::CTextureDrvShare*)NULL);
// create and set iterator, for future deletion. // create and set iterator, for future deletion.
*it= tex.TextureDrvShare= new CTextureDrvShare(this, it, &tex); *it = tex.TextureDrvShare = new CTextureDrvShare(this, it, &tex);
// Must (re)-create the texture. // Must (re)-create the texture.
mustCreate = true; mustCreate = true;
@ -699,8 +690,8 @@ bool CDriverGL3::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
setupTextureBasicParameters(tex); // setup what has changed (will reset the touch flag) setupTextureBasicParameters(tex); // setup what has changed (will reset the touch flag)
// Disable texture 0 // Disable texture 0
_CurrentTexture[0]= NULL; _CurrentTexture[0] = NULL;
_CurrentTextureInfoGL[0]= NULL; _CurrentTextureInfoGL[0] = NULL;
_DriverGLStates.setTextureMode(CDriverGLStates3::TextureDisabled); _DriverGLStates.setTextureMode(CDriverGLStates3::TextureDisabled);
// //
} }
@ -711,8 +702,8 @@ bool CDriverGL3::setupTextureEx (ITexture& tex, bool bUpload, bool &bAllUploaded
// 1. If modified, may (re)load texture part or all of the texture. // 1. If modified, may (re)load texture part or all of the texture.
//================================================================= //=================================================================
bool mustLoadAll= false; bool mustLoadAll = false;
bool mustLoadPart= false; bool mustLoadPart = false;
// To avoid any delete/new ptr problem, disable all texturing. // To avoid any delete/new ptr problem, disable all texturing.
/* If an old texture is deleted, _CurrentTexture[*] and _CurrentTextureInfoGL[*] are invalid. /* If an old texture is deleted, _CurrentTexture[*] and _CurrentTextureInfoGL[*] are invalid.
@ -1267,32 +1258,29 @@ 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...
//======================
// If the shared texture is the same than before, no op. // If the shared texture is the same than before, no op.
if (_CurrentTextureInfoGL[stage] != gltext) if (_CurrentTextureInfoGL[stage] != gltext)
{ {
// Cache setup. // Cache setup.
_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));
}
} }
} }
} }

Loading…
Cancel
Save