本文整理汇总了C#中TextureUnit类的典型用法代码示例。如果您正苦于以下问题:C# TextureUnit类的具体用法?C# TextureUnit怎么用?C# TextureUnit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextureUnit类属于命名空间,在下文中一共展示了TextureUnit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FrameBufferObject
public FrameBufferObject(int width, int height, TextureUnit textureUnit, string description)
{
SetFrameBufferHandles(width, height, textureUnit, description);
GL.GenTextures(1, out mFboTexture);
SetupFrameBufferTexture();
GL.Ext.GenFramebuffers(1, out fbo_handle);
}
示例2: Use
public void Use(TextureUnit unit)
{
if(!Generated)
{
Handle = GL.GenTexture();
GL.Enable(EnableCap.TextureCubeMapSeamless);
GL.BindTexture(TextureTarget.TextureCubeMap, Handle);
GL.TexImage2D(TextureTarget.TextureCubeMapPositiveX, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, BitmapPosX);
GL.TexImage2D(TextureTarget.TextureCubeMapPositiveY, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, BitmapPosY);
GL.TexImage2D(TextureTarget.TextureCubeMapPositiveZ, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, BitmapPosZ);
GL.TexImage2D(TextureTarget.TextureCubeMapNegativeX, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, BitmapNegX);
GL.TexImage2D(TextureTarget.TextureCubeMapNegativeY, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, BitmapNegY);
GL.TexImage2D(TextureTarget.TextureCubeMapNegativeZ, 0, PixelInternalFormat.Rgba, Size.Width, Size.Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, BitmapNegZ);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.LinearMipmapLinear);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.GenerateMipmap(GenerateMipmapTarget.TextureCubeMap);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.TextureCubeMap, TextureParameterName.TextureWrapR, (int)TextureWrapMode.Repeat);
FreeCPU();
Generated = true;
}
GL.ActiveTexture(unit);
GL.BindTexture(TextureTarget.TextureCubeMap, Handle);
}
示例3: VertexElement
public VertexElement(VertexElementFormat type, VertexElementUsage kind, TextureUnit unit)
: this()
{
Type = type;
Kind = kind;
Unit = unit;
}
示例4: Bind
/// <summary>
/// Binds the <see cref="Sampler"/> to the <see cref="P:TextureUnit"/>.
/// </summary>
public Binding Bind(TextureUnit textureUnit)
{
this.VerifyAccess();
this.textureUnit = textureUnit;
GL.BindSampler(textureUnit, this);
return new Binding(this);
}
示例5: TerrainTexture
public TerrainTexture(TextureUnit unit, int sideVertexCount, string sourceFormat, int maxLevels)
: base(unit, GetImageArray(sourceFormat, maxLevels, sideVertexCount))
{
this.MinFilter = TextureMinFilter.Nearest;
this.MagFilter = TextureMagFilter.Nearest;
this.WrapS = TextureWrapMode.ClampToBorder;
this.WrapT = TextureWrapMode.ClampToBorder;
}
示例6: ActiveTexture
public static void ActiveTexture(TextureUnit textureUnit)
{
if (textureUni != textureUnit)
{
textureUni = textureUnit;
GL.ActiveTexture(textureUnit);
}
}
示例7:
public Texture this[TextureUnit texUnit]
{
get
{
if (!_textures.ContainsKey(texUnit)) return null;
return _textures[texUnit];
}
}
示例8: SamplerEffectUniform
public SamplerEffectUniform(EffectPass pass, ProgramUniform uniform, TextureUnit textureUnit)
: base(pass, uniform)
{
Contract.Requires<ArgumentNullException>(pass != null);
Contract.Requires<ArgumentNullException>(uniform != null);
Contract.Requires<ArgumentOutOfRangeException>(textureUnit >= TextureUnit.Zero);
this.TextureUnit = textureUnit;
}
示例9: TextureArray
public TextureArray(TextureUnit unit, ImageArray images)
: base(unit, images)
{
dirtyRegions = new HashSet<Region2D>[images.Depth];
for (int i = 0; i < dirtyRegions.Length; i++)
{
dirtyRegions[i] = new HashSet<Region2D>();
}
}
示例10: ChangeResolution
public void ChangeResolution(int width, int height, TextureUnit textureUnit, string description)
{
//Detach(); // monster crash fix ?
SetFrameBufferHandles(width, height, textureUnit, description);
Detach();
SetupFrameBufferTexture();
}
示例11: Use
public void Use(TextureUnit unit)
{
if(!Generated)
{
Handle = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture2D, Handle);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, Width, Height, 0, OpenTK.Graphics.OpenGL4.PixelFormat.Bgra, PixelType.UnsignedByte, Data);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Nearest);
GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Nearest);
Generated = true;
}
GL.ActiveTexture(unit);
GL.BindTexture(TextureTarget.Texture2D, Handle);
}
示例12: LoadTexture
/// <summary>
/// Loads the given image as a 32bpp RGBA texture.
/// </summary>
public static void LoadTexture(Bitmap bmpTex, TextureUnit slot)
{
Debug.WriteLine("loading array texture");
BitmapData bmpDataTex = bmpTex.LockBits(
new Rectangle(0, 0, bmpTex.Width, bmpTex.Height),
ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
Debug.WriteLine("loaded " + bmpTex.Width + "x" + bmpTex.Height + " tex, binding");
// set it as texture 0
GL.ActiveTexture(slot);
GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba,
bmpTex.Width, bmpTex.Height, 0,
OpenTK.Graphics.OpenGL.PixelFormat.Rgba, PixelType.UnsignedByte,
bmpDataTex.Scan0);
// clean up
bmpTex.UnlockBits(bmpDataTex);
Debug.WriteLine("array texture loaded");
}
示例13: Use
public void Use(TextureUnit unit)
{
if(!Generated)
{
Handle = GL.GenTexture();
GL.BindTexture(TextureTarget.Texture3D, Handle);
GL.TexImage3D(TextureTarget.Texture3D, 0, PixelInternalFormat.R32ui, (int)Size.X, (int)Size.Y, (int)Size.Z, 0, OpenTK.Graphics.OpenGL4.PixelFormat.RedInteger, PixelType.UnsignedInt, new IntPtr(0));
GL.TexParameter(TextureTarget.Texture3D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
GL.TexParameter(TextureTarget.Texture3D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
GL.TexParameter(TextureTarget.Texture3D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture3D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);
GL.TexParameter(TextureTarget.Texture3D, TextureParameterName.TextureWrapR, (int)TextureWrapMode.Repeat);
Generated = true;
}
GL.ActiveTexture(unit);
GL.BindTexture(TextureTarget.Texture3D, Handle);
}
示例14: State
public bool ForceState; // the next GL_State will ignore glStateBits and set everything.
public State()
{
int count = TextureUnits.Length;
for(int i = 0; i < count; i++)
{
TextureUnits[i] = new TextureUnit();
}
}
示例15: Bind
/// <summary>
/// Binds the texture to the given texture unit at its default texture target.
/// </summary>
/// <param name="unit">The texture unit to bind to.</param>
public void Bind(TextureUnit unit)
{
GL.ActiveTexture(unit);
Bind();
}