myTexClamp (GL_CLAMP_TO_EDGE),
myMaxTexDim (1024),
myMaxTexCombined (1),
+ myMaxTexUnitsFFP (1),
myMaxDumpSizeX (1024),
myMaxDumpSizeY (1024),
myMaxClipPlanes (6),
}
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &myMaxTexDim);
- if (IsGlGreaterEqual (2, 0))
- {
- glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
- }
#if !defined(GL_ES_VERSION_2_0)
- else if (IsGlGreaterEqual (1, 3))
+ if (IsGlGreaterEqual (1, 3) && core11 != NULL)
{
// 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);
+ // usually smaller than combined texture units available for GLSL
+ glGetIntegerv (GL_MAX_TEXTURE_UNITS, &myMaxTexUnitsFFP);
+ myMaxTexCombined = myMaxTexUnitsFFP;
}
#endif
+ if (IsGlGreaterEqual (2, 0))
+ {
+ glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
+ }
mySpriteTexUnit = myMaxTexCombined >= 2
? Graphic3d_TextureUnit_1
: Graphic3d_TextureUnit_0;
{
if (const Handle(OpenGl_Texture)& aTextureOld = aTextureIterOld.Value())
{
+ aTextureOld->Unbind(aThisCtx);
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL)
{
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
}
#endif
- aTextureOld->Unbind (aThisCtx);
}
}
break;
{
if (!aTextureOld.IsNull())
{
+ aTextureOld->Unbind(aThisCtx);
#if !defined(GL_ES_VERSION_2_0)
if (core11 != NULL)
{
OpenGl_Sampler::resetGlobalTextureParams (aThisCtx, *aTextureOld, aTextureOld->Sampler()->Parameters());
}
#endif
- aTextureOld->Unbind (aThisCtx);
}
aTextureIterNew.Next();
//! @return value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
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
Graphic3d_TextureUnit SpriteTextureUnit() const { return mySpriteTexUnit; }
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 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 myMaxDumpSizeY; //!< maximum FBO height for image dump
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES