Commit 0b64c2e2 authored by Julien Jomier's avatar Julien Jomier

ENH: Added support for ClampToBorder (as it was in OpenGL)

Change-Id: I92fa3a2a9acc8b82327651ae76413444a32a0631
ENH: Added support for border color
parent 3bba750a
......@@ -74,20 +74,38 @@ static const char *DepthTextureCompareFunctionAsString[8]=
"Never"
};
// Mapping from Wrap values to OpenGL values.
static GLint OpenGLWrap[3]=
{
GL_CLAMP_TO_EDGE,
GL_REPEAT,
GL_MIRRORED_REPEAT
};
static const char *WrapAsString[3]=
{
"ClampToEdge",
"Repeat",
"MirroredRepeat"
};
// Mapping from Wrap values to OpenGL values
#if GL_ES_VERSION_2_0 != 1
static GLint OpenGLWrap[4]=
{
GL_CLAMP_TO_EDGE,
GL_REPEAT,
GL_MIRRORED_REPEAT,
GL_CLAMP_TO_BORDER
};
static const char *WrapAsString[4]=
{
"ClampToEdge",
"Repeat",
"MirroredRepeat",
"ClampToBorder"
};
#else
static GLint OpenGLWrap[3]=
{
GL_CLAMP_TO_EDGE,
GL_REPEAT,
GL_MIRRORED_REPEAT
};
static const char *WrapAsString[3]=
{
"ClampToEdge",
"Repeat",
"MirroredRepeat"
};
#endif
// Mapping MinificationFilter values to OpenGL values.
static GLint OpenGLMinFilter[6]=
......@@ -199,6 +217,11 @@ vtkTextureObject::vtkTextureObject()
this->DepthTextureCompareFunction = Lequal;
this->GenerateMipmap = false;
this->ShaderProgram = NULL;
this->BorderColor[0] = 0.0f;
this->BorderColor[1] = 0.0f;
this->BorderColor[2] = 0.0f;
this->BorderColor[3] = 0.0f;
this->DrawPixelsActor = NULL;
}
//----------------------------------------------------------------------------
......@@ -481,6 +504,8 @@ void vtkTextureObject::SendParameters()
GL_TEXTURE_MAG_FILTER,
OpenGLMagFilter[this->MagnificationFilter]);
glTexParameterfv(this->Target,GL_TEXTURE_BORDER_COLOR,this->BorderColor);
#if GL_ES_VERSION_2_0 != 1
glTexParameterf(this->Target,GL_TEXTURE_MIN_LOD,this->MinLOD);
glTexParameterf(this->Target,GL_TEXTURE_MAX_LOD,this->MaxLOD);
......
......@@ -55,7 +55,18 @@ public:
NumberOfDepthTextureCompareFunctions
};
// Wrap values.
// ClampToBorder is not supported in ES 2.0
// Wrap values.
#if GL_ES_VERSION_2_0 != 1
enum
{
ClampToEdge=0,
Repeat,
MirroredRepeat,
ClampToBorder,
NumberOfWrapModes
};
#else
enum
{
ClampToEdge=0,
......@@ -63,6 +74,7 @@ public:
MirroredRepeat,
NumberOfWrapModes
};
#endif
// MinificationFilter values.
enum
......@@ -357,6 +369,13 @@ public:
bool GetLinearMagnification()
{ return this->MagnificationFilter==Linear; }
// Description:
// Border Color (RGBA). The values can be any valid float value,
// if the gpu supports it. Initial value is (0.0f,0.0f,0.0f,0.0f)
// , as in OpenGL spec.
vtkSetVector4Macro(BorderColor,float);
vtkGetVector4Macro(BorderColor,float);
// Description:
// Lower-clamp the computed LOD against this value. Any float value is valid.
// Initial value is -1000.0f, as in OpenGL spec.
......@@ -525,7 +544,7 @@ protected:
float MaxLOD;
int BaseLevel;
int MaxLevel;
float BorderColor[4];
bool DepthTextureCompare;
int DepthTextureCompareFunction;
......
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