Commit 9e0107e5 authored by Ken Martin's avatar Ken Martin Committed by Kitware Robot

Merge topic 'add_method_for_external_code'

86327d1e Add method for external codes
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Berk Geveci's avatarBerk Geveci <berk.geveci@kitware.com>
Merge-request: !222
parents f80a46cd 86327d1e
......@@ -134,6 +134,18 @@ int vtkTextureUnitManager::Allocate()
return result;
}
int vtkTextureUnitManager::Allocate(int unit)
{
if (this->IsAllocated(unit))
{
return -1;
}
this->TextureUnits[unit] = true;
return unit;
}
// ----------------------------------------------------------------------------
// Description:
// Tell if texture unit `textureUnitId' is already allocated.
......
......@@ -61,6 +61,18 @@ public:
// \post allocated: result==-1 || this->IsAllocated(result)
virtual int Allocate();
// Description:
// Reserve a specific texture unit if not already in use.
// This method should only be used when interacting with 3rd
// party code that is allocating and using textures. It allows
// someone to reserve a texture unit for that code and later release
// it. VTK will not use that texture unit until it is released.
// It returns -1 if the allocation failed (because there are no more
// texture units left).
// \post valid_result: result==-1 || result>=0 && result<this->GetNumberOfTextureUnits())
// \post allocated: result==-1 || this->IsAllocated(result)
virtual int Allocate(int unit);
// Description:
// Tell if texture unit `textureUnitId' is already allocated.
// \pre valid_textureUnitId_range : textureUnitId>=0 && textureUnitId<this->GetNumberOfTextureUnits()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment