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

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

View File

@@ -987,6 +987,13 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
mySizeY = (GLsizei )theSize;
myTextFormat = aFormat.Format();
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);
applyDefaultSamplerParams (theCtx);
@@ -1080,7 +1087,7 @@ bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx,
}
glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0,
aFormat.InternalFormat(),
anIntFormat,
GLsizei(theSize), GLsizei(theSize),
0, aFormat.PixelFormat(), aFormat.DataType(),
aData);