X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=blobdiff_plain;f=src%2FOpenGl%2FOpenGl_Texture.cxx;h=aa01fac17bcaf71bf676c0231f17b9f51d069bf3;hb=67312b7991c945e66d4fa1d3a6f8e02dbabc9b5a;hpb=f4a7308f61af6cde23a6380eb8127695b75f4690 diff --git a/src/OpenGl/OpenGl_Texture.cxx b/src/OpenGl/OpenGl_Texture.cxx index a6553ac405..aa01fac17b 100644 --- a/src/OpenGl/OpenGl_Texture.cxx +++ b/src/OpenGl/OpenGl_Texture.cxx @@ -563,7 +563,7 @@ bool OpenGl_Texture::Init (const Handle(OpenGl_Context)& theCtx, { case Graphic3d_TOT_CUBEMAP: { - return initCubeMap (theCtx, Handle(Graphic3d_CubeMap)::DownCast(theTextureMap), + return InitCubeMap (theCtx, Handle(Graphic3d_CubeMap)::DownCast(theTextureMap), 0, Image_Format_RGB, false, theTextureMap->IsColorMap()); } default: @@ -793,10 +793,10 @@ bool OpenGl_Texture::Init3D (const Handle(OpenGl_Context)& theCtx, } // ======================================================================= -// function : initCubeMap +// function : InitCubeMap // purpose : // ======================================================================= -bool OpenGl_Texture::initCubeMap (const Handle(OpenGl_Context)& theCtx, +bool OpenGl_Texture::InitCubeMap (const Handle(OpenGl_Context)& theCtx, const Handle(Graphic3d_CubeMap)& theCubeMap, Standard_Size theSize, Image_Format theFormat, @@ -811,6 +811,7 @@ bool OpenGl_Texture::initCubeMap (const Handle(OpenGl_Context)& theCtx, if (!theCubeMap.IsNull()) { + theToGenMipmap = theCubeMap->HasMipmaps(); if (Handle(Image_PixMap) anImage = theCubeMap->Reset().Value()) { theSize = anImage->SizeX(); @@ -836,6 +837,8 @@ bool OpenGl_Texture::initCubeMap (const Handle(OpenGl_Context)& theCtx, myTarget = GL_TEXTURE_CUBE_MAP; myHasMipmaps = theToGenMipmap; myNbSamples = 1; + mySizeX = (GLsizei )theSize; + mySizeY = (GLsizei )theSize; Bind (theCtx); applyDefaultSamplerParams (theCtx); @@ -991,6 +994,10 @@ Standard_Size OpenGl_Texture::EstimatedDataSize() const { aSize *= Standard_Size(mySizeZ); } + if (myTarget == GL_TEXTURE_CUBE_MAP) + { + aSize *= 6; // cube sides + } if (myHasMipmaps) { aSize = aSize + aSize / 3;