|
|
|
@ -781,11 +781,7 @@ void CDriverGL::bindTextureWithMode(ITexture &tex)
|
|
|
|
|
{
|
|
|
|
|
_DriverGLStates.setTextureMode(CDriverGLStates::TextureCubeMap);
|
|
|
|
|
// Bind this texture
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
|
|
|
|
|
#else
|
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -820,19 +816,13 @@ void CDriverGL::setupTextureBasicParameters(ITexture &tex)
|
|
|
|
|
{
|
|
|
|
|
if (_Extensions.ARBTextureCubeMap)
|
|
|
|
|
{
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
|
// glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
|
#else
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_S, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_T, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
|
#ifndef USE_OPENGLES
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_WRAP_R, translateWrapToGl(ITexture::Clamp, _Extensions));
|
|
|
|
|
#endif
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -1516,31 +1506,19 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
|
|
|
|
|
_CurrentTextureInfoGL[stage]= gltext;
|
|
|
|
|
|
|
|
|
|
// setup this texture
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP_OES, gltext->ID);
|
|
|
|
|
#else
|
|
|
|
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, gltext->ID);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Change parameters of texture, if necessary.
|
|
|
|
|
//============================================
|
|
|
|
|
if(gltext->MagFilter!= tex->getMagFilter())
|
|
|
|
|
{
|
|
|
|
|
gltext->MagFilter= tex->getMagFilter();
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
|
#else
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MAG_FILTER, translateMagFilterToGl(gltext));
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
if(gltext->MinFilter!= tex->getMinFilter())
|
|
|
|
|
{
|
|
|
|
|
gltext->MinFilter= tex->getMinFilter();
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_OES,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
|
#else
|
|
|
|
|
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB,GL_TEXTURE_MIN_FILTER, translateMinFilterToGl(gltext));
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1617,34 +1595,16 @@ bool CDriverGL::activateTexture(uint stage, ITexture *tex)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This maps the CMaterial::TTexOperator
|
|
|
|
|
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD,
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
GL_ADD_SIGNED, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE, GL_INTERPOLATE
|
|
|
|
|
#else
|
|
|
|
|
GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
static const GLenum OperatorLUT[9]= { GL_REPLACE, GL_MODULATE, GL_ADD, GL_ADD_SIGNED_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_INTERPOLATE_EXT, GL_BUMP_ENVMAP_ATI };
|
|
|
|
|
|
|
|
|
|
// This maps the CMaterial::TTexSource
|
|
|
|
|
static const GLenum SourceLUT[4]= { GL_TEXTURE,
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT
|
|
|
|
|
#else
|
|
|
|
|
GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
static const GLenum SourceLUT[4]= { GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT };
|
|
|
|
|
|
|
|
|
|
// This maps the CMaterial::TTexOperand
|
|
|
|
|
static const GLenum OperandLUT[4]= { GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA };
|
|
|
|
|
|
|
|
|
|
// This maps the CMaterial::TTexOperator, used for openGL Arg2 setup.
|
|
|
|
|
static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE,
|
|
|
|
|
#ifdef USE_OPENGLES
|
|
|
|
|
GL_PREVIOUS, GL_PRIMARY_COLOR, GL_CONSTANT
|
|
|
|
|
#else
|
|
|
|
|
GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
static const GLenum InterpolateSrcLUT[8]= { GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_TEXTURE, GL_PREVIOUS_EXT, GL_PRIMARY_COLOR_EXT, GL_CONSTANT_EXT };
|
|
|
|
|
|
|
|
|
|
#ifndef USE_OPENGLES
|
|
|
|
|
|
|
|
|
|