本文整理汇总了C#中TextureTarget.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# TextureTarget.ToString方法的具体用法?C# TextureTarget.ToString怎么用?C# TextureTarget.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextureTarget
的用法示例。
在下文中一共展示了TextureTarget.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
/// <summary>
/// Update the texture quality settings for the currently bound texture
/// </summary>
/// <param name="target">The GL texture target</param>
public void Update(TextureTarget target)
{
if(mipmapsDirty)
{
mipmapsDirty = false;
if(mipmaps)
{
GL.TexParameter(target, TextureParameterName.TextureBaseLevel, 0);
int levels = mipmapLevels;
if (levels < 0)
{
levels = 1000;
}
//GL.TexParameter(target, TextureParameterName.TextureMaxLevel, levels);
if(!pregeneratedMipmaps)
{
GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
switch (target)
{
case TextureTarget.Texture1D:
GL.GenerateMipmap(GenerateMipmapTarget.Texture1D);
break;
case TextureTarget.Texture2D:
GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
break;
case TextureTarget.Texture3D:
GL.GenerateMipmap(GenerateMipmapTarget.Texture3D);
break;
case TextureTarget.Texture1DArray:
GL.GenerateMipmap(GenerateMipmapTarget.Texture1DArray);
break;
case TextureTarget.Texture2DArray:
GL.GenerateMipmap(GenerateMipmapTarget.Texture2DArray);
break;
case TextureTarget.TextureCubeMap:
GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMap);
break;
case TextureTarget.TextureCubeMapArray:
GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMapArray);
break;
case TextureTarget.Texture2DMultisample:
GL.GenerateMipmap(GenerateMipmapTarget.Texture2DMultisample);
break;
case TextureTarget.Texture2DMultisampleArray:
GL.GenerateMipmap(GenerateMipmapTarget.Texture2DMultisampleArray);
break;
default:
throw new NotImplementedException("Generating mipmaps not supported for TextureTarget." + target.ToString() + ". Currently supported mipmaps are: Texture1D, Texture2D, Texture3D, Texture1DArray, Texture2DArray, TextureCubeMap, TextureCubeMapArray, Texture2DMultisample, Texture2DMultisampleArray.");
}
}
}
}
if(textureFilteringDirty)
{
if(target == TextureTarget.Texture2D || target == TextureTarget.TextureCubeMap)
{
switch (textureFiltering)
{
case TextureFiltering.Nearest:
GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
if (mipmaps)
{
GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.NearestMipmapNearest);
}
else
{
GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
}
break;
case TextureFiltering.Bilinear:
GL.TexParameter(target, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
if (mipmaps)
{
GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapNearest);
}
else
{
GL.TexParameter(target, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
}
break;
case TextureFiltering.Trilinear:
//.........这里部分代码省略.........