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:
@@ -226,7 +226,10 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
||||
if (theTarget == GL_TEXTURE_3D
|
||||
|| 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;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user