Commit 301a81ce authored by Aashish Chaudhary's avatar Aashish Chaudhary

Added ability to use texture modes

Change-Id: I143d065b40e05670d9fd78b3193d409c24c77fa6
parent 3ed3f22d
......@@ -390,11 +390,15 @@ void vtkTextureObject::CreateTexture()
// See: http://www.opengl.org/wiki/Common_Mistakes#Creating_a_complete_texture
// turn off mip map filter or set the base and max level correctly. here
// both are done.
glTexParameteri(this->Target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(this->Target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(this->Target, GL_TEXTURE_MIN_FILTER,
this->GetMinificationFilterMode(this->MinificationFilter));
glTexParameteri(this->Target, GL_TEXTURE_MAG_FILTER,
this->GetMagnificationFilterMode(this->MagnificationFilter));
glTexParameteri(this->Target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(this->Target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(this->Target, GL_TEXTURE_WRAP_S,
this->GetWrapSMode(this->WrapS));
glTexParameteri(this->Target, GL_TEXTURE_WRAP_T,
this->GetWrapTMode(this->WrapT));
#ifdef GL_TEXTURE_BASE_LEVEL
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
......@@ -1068,6 +1072,66 @@ unsigned int vtkTextureObject::GetDepthTextureModeFormat(int vtktype)
}
}
//----------------------------------------------------------------------------
unsigned int vtkTextureObject::GetMinificationFilterMode(int vtktype)
{
switch(vtktype)
{
case Nearest:
return GL_NEAREST;
case Linear:
return GL_LINEAR;
case NearestMipmapNearest:
return GL_NEAREST_MIPMAP_NEAREST;
case NearestMipmapLinear:
return GL_NEAREST_MIPMAP_LINEAR;
case LinearMipmapNearest:
return GL_LINEAR_MIPMAP_NEAREST;
case LinearMipmapLinear:
return GL_LINEAR_MIPMAP_LINEAR;
default:
return GL_NEAREST;
}
}
//----------------------------------------------------------------------------
unsigned int vtkTextureObject::GetMagnificationFilterMode(int vtktype)
{
switch(vtktype)
{
case Nearest:
return GL_NEAREST;
case Linear:
return GL_LINEAR;
default:
return GL_NEAREST;
}
}
//----------------------------------------------------------------------------
unsigned int vtkTextureObject::GetWrapSMode(int vtktype)
{
switch(vtktype)
{
case ClampToEdge:
return GL_CLAMP_TO_EDGE;
case Repeat:
return GL_REPEAT;
case ClampToBorder:
return GL_CLAMP_TO_BORDER;
case MirroredRepeat:
return GL_MIRRORED_REPEAT;
default:
return GL_CLAMP_TO_EDGE;
}
}
//----------------------------------------------------------------------------
unsigned int vtkTextureObject::GetWrapTMode(int vtktype)
{
return this->GetWrapSMode(vtktype);
}
#if GL_ES_VERSION_2_0 != 1
//----------------------------------------------------------------------------
......
......@@ -309,6 +309,10 @@ public:
unsigned int GetFormat(int vtktype, int numComps,
bool shaderSupportsTextureInt);
unsigned int GetDepthTextureModeFormat(int vtktype);
unsigned int GetMinificationFilterMode(int vtktype);
unsigned int GetMagnificationFilterMode(int vtktype);
unsigned int GetWrapSMode(int vtktype);
unsigned int GetWrapTMode(int vtkTypeFloat32);
// Description:
// Optional, require support for floating point depth buffer
......
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