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:
@@ -225,8 +225,11 @@ void OpenGl_Sampler::applySamplerParams (const Handle(OpenGl_Context)& theCtx,
|
|||||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_T, aWrapMode);
|
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_T, aWrapMode);
|
||||||
if (theTarget == GL_TEXTURE_3D
|
if (theTarget == GL_TEXTURE_3D
|
||||||
|| theTarget == GL_TEXTURE_CUBE_MAP)
|
|| theTarget == GL_TEXTURE_CUBE_MAP)
|
||||||
|
{
|
||||||
|
if (theCtx->HasTextureBaseLevel())
|
||||||
{
|
{
|
||||||
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_R, aWrapMode);
|
setParameter (theCtx, theSampler, theTarget, GL_TEXTURE_WRAP_R, aWrapMode);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
Reference in New Issue
Block a user