mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0030963: Visualization, TKOpenGl - texture unit error during FFP global texture's parameters processing
The texture units used in FFP texture functions are correct now.
This commit is contained in:
parent
3068c3bb65
commit
5c225e8e07
@ -162,6 +162,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
|||||||
myTexClamp (GL_CLAMP_TO_EDGE),
|
myTexClamp (GL_CLAMP_TO_EDGE),
|
||||||
myMaxTexDim (1024),
|
myMaxTexDim (1024),
|
||||||
myMaxTexCombined (1),
|
myMaxTexCombined (1),
|
||||||
|
myMaxTexUnitsFFP (1),
|
||||||
myMaxDumpSizeX (1024),
|
myMaxDumpSizeX (1024),
|
||||||
myMaxDumpSizeY (1024),
|
myMaxDumpSizeY (1024),
|
||||||
myMaxClipPlanes (6),
|
myMaxClipPlanes (6),
|
||||||
@ -1557,18 +1558,19 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
|
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
|
||||||
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
|
if (IsGlGreaterEqual (1, 3) && core11 != NULL)
|
||||||
|
{
|
||||||
|
// this is a maximum of texture units for FFP functionality,
|
||||||
|
// usually smaller than combined texture units available for GLSL
|
||||||
|
glGetIntegerv (GL_MAX_TEXTURE_UNITS, &myMaxTexUnitsFFP);
|
||||||
|
myMaxTexCombined = myMaxTexUnitsFFP;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (IsGlGreaterEqual (2, 0))
|
if (IsGlGreaterEqual (2, 0))
|
||||||
{
|
{
|
||||||
glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
|
glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
|
||||||
}
|
}
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
|
||||||
else if (IsGlGreaterEqual (1, 3))
|
|
||||||
{
|
|
||||||
// this is a maximum of texture units for FFP functionality,
|
|
||||||
// dramatically smaller than combined texture units available for GLSL
|
|
||||||
glGetIntegerv (GL_MAX_TEXTURE_UNITS, &myMaxTexCombined);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
mySpriteTexUnit = myMaxTexCombined >= 2
|
mySpriteTexUnit = myMaxTexCombined >= 2
|
||||||
? Graphic3d_TextureUnit_1
|
? Graphic3d_TextureUnit_1
|
||||||
: Graphic3d_TextureUnit_0;
|
: Graphic3d_TextureUnit_0;
|
||||||
@ -3233,13 +3235,13 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
|
|||||||
{
|
{
|
||||||
if (const Handle(OpenGl_Texture)& aTextureOld = aTextureIterOld.Value())
|
if (const Handle(OpenGl_Texture)& aTextureOld = aTextureIterOld.Value())
|
||||||
{
|
{
|
||||||
|
aTextureOld->Unbind(aThisCtx);
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
if (core11 != NULL)
|
if (core11 != NULL)
|
||||||
{
|
{
|
||||||
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
|
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
aTextureOld->Unbind (aThisCtx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3260,13 +3262,13 @@ Handle(OpenGl_TextureSet) OpenGl_Context::BindTextures (const Handle(OpenGl_Text
|
|||||||
{
|
{
|
||||||
if (!aTextureOld.IsNull())
|
if (!aTextureOld.IsNull())
|
||||||
{
|
{
|
||||||
|
aTextureOld->Unbind(aThisCtx);
|
||||||
#if !defined(GL_ES_VERSION_2_0)
|
#if !defined(GL_ES_VERSION_2_0)
|
||||||
if (core11 != NULL)
|
if (core11 != NULL)
|
||||||
{
|
{
|
||||||
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
|
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
aTextureOld->Unbind (aThisCtx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aTextureIterNew.Next();
|
aTextureIterNew.Next();
|
||||||
|
@ -497,6 +497,11 @@ public:
|
|||||||
//! @return value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
//! @return value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
||||||
Standard_Integer MaxCombinedTextureUnits() const { return myMaxTexCombined; }
|
Standard_Integer MaxCombinedTextureUnits() const { return myMaxTexCombined; }
|
||||||
|
|
||||||
|
//! This method returns the multi-texture limit for obsolete fixed-function pipeline.
|
||||||
|
//! Use MaxCombinedTextureUnits() instead for limits for using programmable pipeline.
|
||||||
|
//! @return value for GL_MAX_TEXTURE_UNITS
|
||||||
|
Standard_Integer MaxTextureUnitsFFP() const { return myMaxTexUnitsFFP; }
|
||||||
|
|
||||||
//! @return texture unit to be used for sprites
|
//! @return texture unit to be used for sprites
|
||||||
Graphic3d_TextureUnit SpriteTextureUnit() const { return mySpriteTexUnit; }
|
Graphic3d_TextureUnit SpriteTextureUnit() const { return mySpriteTexUnit; }
|
||||||
|
|
||||||
@ -965,6 +970,7 @@ private: // context info
|
|||||||
Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
|
Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
|
||||||
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
|
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
|
||||||
Standard_Integer myMaxTexCombined; //!< value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
Standard_Integer myMaxTexCombined; //!< value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
||||||
|
Standard_Integer myMaxTexUnitsFFP; //!< value for GL_MAX_TEXTURE_UNITS (fixed-function pipeline only)
|
||||||
Standard_Integer myMaxDumpSizeX; //!< maximum FBO width for image dump
|
Standard_Integer myMaxDumpSizeX; //!< maximum FBO width for image dump
|
||||||
Standard_Integer myMaxDumpSizeY; //!< maximum FBO height for image dump
|
Standard_Integer myMaxDumpSizeY; //!< maximum FBO height for image dump
|
||||||
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
|
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
|
||||||
|
@ -276,7 +276,8 @@ void OpenGl_Sampler::applyGlobalTextureParams (const Handle(OpenGl_Context)& the
|
|||||||
(void )theTexture;
|
(void )theTexture;
|
||||||
(void )theParams;
|
(void )theParams;
|
||||||
#else
|
#else
|
||||||
if (theCtx->core11 == NULL)
|
if (theCtx->core11 == NULL
|
||||||
|
|| theParams->TextureUnit() >= theCtx->MaxTextureUnitsFFP())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user