1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-05 18:16:23 +03:00

0031372: Visualization, TKOpenGl - failed to create texture on OpenGL ES 2.0 due to unknown GL_TEXTURE_BASE_LEVEL

OpenGl_Sampler::applySamplerParams() has been corrected to check for OpenGL ES 3.0
when applying GL_TEXTURE_BASE_LEVEL/GL_TEXTURE_MAX_LEVEL parameters.
This commit is contained in:
kgv 2020-02-14 19:29:51 +03:00
parent 28b13b31aa
commit cd43c08f2b
2 changed files with 12 additions and 2 deletions

View File

@ -495,6 +495,16 @@ public:
//! Either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1).
Standard_Integer TextureWrapClamp() const { return myTexClamp; }
//! @return true if texture parameters GL_TEXTURE_BASE_LEVEL/GL_TEXTURE_MAX_LEVEL are supported.
Standard_Boolean HasTextureBaseLevel() const
{
#if !defined(GL_ES_VERSION_2_0)
return IsGlGreaterEqual (1, 2);
#else
return IsGlGreaterEqual (3, 0);
#endif
}
//! @return maximum degree of anisotropy texture filter
Standard_Integer MaxDegreeOfAnisotropy() const { return myAnisoMax; }

View File

@ -263,8 +263,8 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, aDegree);
}
if (theCtx->IsGlGreaterEqual(1, 2) &&
(theSampler == NULL || !theSampler->isValidSampler()))
if (theCtx->HasTextureBaseLevel()
&& (theSampler == NULL || !theSampler->isValidSampler()))
{
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_BASE_LEVEL, theParams->BaseLevel());
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_MAX_LEVEL, theParams->MaxLevel());