1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0031580: Visualization, TKOpenGl - cubemap initialization error on OpenGL ES 2.0

OpenGl_Texture::InitCubeMap() now avoids using sized internal format in case of GLES2.
OpenGl_Sampler::applySamplerParams() now checks OpenGL version before setting GL_TEXTURE_WRAP_R.
This commit is contained in:
kgv
2020-05-27 13:36:17 +03:00
committed by bugmaster
parent 04c5a696e4
commit e4e3254a35
2 changed files with 12 additions and 2 deletions

View File

@@ -226,7 +226,10 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
if (theTarget == GL_TEXTURE_3D if (theTarget == GL_TEXTURE_3D
|| theTarget == GL_TEXTURE_CUBE_MAP) || theTarget == GL_TEXTURE_CUBE_MAP)
{ {
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_R, aWrapMode); if (theCtx->HasTextureBaseLevel())
{
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_R, aWrapMode);
}
return; return;
} }

View File

@@ -987,6 +987,13 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
mySizeY = (GLsizei )theSize; mySizeY = (GLsizei )theSize;
myTextFormat = aFormat.Format(); myTextFormat = aFormat.Format();
mySizedFormat = aFormat.Internal(); mySizedFormat = aFormat.Internal();
#if !defined(GL_ES_VERSION_2_0)
const GLint anIntFormat = aFormat.InternalFormat();
#else
// ES 2.0 does not support sized formats and format conversions - them detected from data type
const GLint anIntFormat = theCtx->IsGlGreaterEqual (3, 0) ? aFormat.InternalFormat() : aFormat.PixelFormat();
#endif
Bind (theCtx); Bind (theCtx);
applyDefaultSamplerParams (theCtx); applyDefaultSamplerParams (theCtx);
@@ -1080,7 +1087,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
} }
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
aFormat.InternalFormat(), anIntFormat,
GLsizei(theSize), GLsizei(theSize), GLsizei(theSize), GLsizei(theSize),
0, aFormat.PixelFormat(), aFormat.DataType(), 0, aFormat.PixelFormat(), aFormat.DataType(),
aData); aData);