Commit 72cfbfef authored by Marcus D. Hanwell's avatar Marcus D. Hanwell
Browse files

ENH: Added an ivar to specify power of two scaling.

Useful with older GPUs, where non power of two textures are not
supported.

Change-Id: Id6cca87482395488c86461b2f3f105e5c34272c6
parent f5e13e73
...@@ -120,6 +120,13 @@ int vtkFreeTypeStringToImage::RenderString(vtkTextProperty *property, ...@@ -120,6 +120,13 @@ int vtkFreeTypeStringToImage::RenderString(vtkTextProperty *property,
return 0; return 0;
} }
//-----------------------------------------------------------------------------
void vtkFreeTypeStringToImage::SetScaleToPowerOfTwo(bool scale)
{
this->vtkStringToImage::SetScaleToPowerOfTwo(scale);
this->Implementation->FreeType->SetScaleToPowerTwo(scale);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void vtkFreeTypeStringToImage::DeepCopy(vtkFreeTypeStringToImage *) void vtkFreeTypeStringToImage::DeepCopy(vtkFreeTypeStringToImage *)
{ {
......
...@@ -59,6 +59,11 @@ public: ...@@ -59,6 +59,11 @@ public:
const vtkStdString& string, const vtkStdString& string,
vtkImageData *data); vtkImageData *data);
// Description:
// Should we produce images at powers of 2, makes rendering on old OpenGL
// hardware easier. Default is false.
virtual void SetScaleToPowerOfTwo(bool scale);
// Description: // Description:
// Make a deep copy of the supplied utility class. // Make a deep copy of the supplied utility class.
void DeepCopy(vtkFreeTypeStringToImage *utility); void DeepCopy(vtkFreeTypeStringToImage *utility);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
vtkStringToImage::vtkStringToImage() vtkStringToImage::vtkStringToImage()
{ {
this->Antialias = true; this->Antialias = true;
this->ScaleToPowerOfTwo = false;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -28,6 +29,16 @@ vtkStringToImage::~vtkStringToImage() ...@@ -28,6 +29,16 @@ vtkStringToImage::~vtkStringToImage()
{ {
} }
//-----------------------------------------------------------------------------
void vtkStringToImage::SetScaleToPowerOfTwo(bool scale)
{
if (this->ScaleToPowerOfTwo != scale)
{
this->ScaleToPowerOfTwo = scale;
this->Modified();
}
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void vtkStringToImage::PrintSelf(ostream &os, vtkIndent indent) void vtkStringToImage::PrintSelf(ostream &os, vtkIndent indent)
{ {
......
...@@ -62,13 +62,18 @@ public: ...@@ -62,13 +62,18 @@ public:
const vtkStdString& string, const vtkStdString& string,
vtkImageData *data) = 0; vtkImageData *data) = 0;
// Description:
// Should we produce images at powers of 2, makes rendering on old OpenGL
// hardware easier. Default is false.
virtual void SetScaleToPowerOfTwo(bool scale);
vtkGetMacro(ScaleToPowerOfTwo, bool)
protected: protected:
vtkStringToImage(); vtkStringToImage();
~vtkStringToImage(); ~vtkStringToImage();
bool Antialias; bool Antialias;
bool ScaleToPowerOfTwo;
private: private:
vtkStringToImage(const vtkStringToImage &); // Not implemented. vtkStringToImage(const vtkStringToImage &); // Not implemented.
......
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