/// <summary> /// Allocates immutable texture storage with the given parameters. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="size">The width and height of the cube map faces.</param> /// <param name="levels">The number of mipmap levels.</param> public TextureCubemap(SizedInternalFormat internalFormat, int size, int levels = 0) : base(internalFormat, GetLevels(levels, size)) { Size = size; GL.BindTexture(TextureTarget, Handle); GL.TexStorage2D((TextureTarget2d)TextureTarget, Levels, InternalFormat, Size, Size); CheckError(); }
/// <summary> /// Allocates immutable texture storage with the given parameters. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="width">The width of the texture.</param> /// <param name="levels">The number of mipmap levels.</param> public Texture1D(SizedInternalFormat internalFormat, int width, int levels = 0) : base(internalFormat, GetLevels(levels, width)) { Width = width; GL.BindTexture(TextureTarget, Handle); GL.TexStorage1D((TextureTarget1d)TextureTarget, Levels, InternalFormat, Width); CheckError(); }
public TextureFormat(PixelFormat format, SizedInternalFormat internalFormat, int bitsPerPixel, bool compressed, PixelType texType) { _format = format; _internalformat = internalFormat; _bitsPerPixel = bitsPerPixel; _compressed = compressed; _texType = texType; }
/// <summary> /// Allocates immutable texture storage with the given parameters. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="width">The width of the texture.</param> /// <param name="height">The height of the texture.</param> public TextureRectangle(SizedInternalFormat internalFormat, int width, int height) : base(internalFormat, 1) { Width = width; Height = height; GL.BindTexture(TextureTarget, Handle); GL.TexStorage2D((TextureTarget2d)TextureTarget, 1, InternalFormat, Width, Height); CheckError(); }
/// <summary> /// Allocates immutable texture storage with the given parameters.<br/> /// A value of zero for the number of mipmap levels will default to the maximum number of levels possible for the given bitmaps width and height. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="width">The width of the texture.</param> /// <param name="height">The height of the texture.</param> /// <param name="levels">The number of mipmap levels.</param> public Texture2D(SizedInternalFormat internalFormat, int width, int height, int levels = 0) : base(internalFormat, GetLevels(levels, width, height)) { Width = width; Height = height; GL.BindTexture(TextureTarget, Handle); GL.TexStorage2D((TextureTarget2d)TextureTarget, Levels, InternalFormat, Width, Height); CheckError(); }
/// <summary> /// Allocates immutable texture storage with the given parameters. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="width">The width of the texture.</param> /// <param name="layers">The number of layers to allocate.</param> /// <param name="levels">The number of mipmap levels.</param> public Texture1DArray(SizedInternalFormat internalFormat, int width, int layers, int levels = 0) : base(internalFormat, GetLevels(levels, width)) { Width = width; Layers = layers; GL.BindTexture(TextureTarget, Handle); GL.TexStorage2D((TextureTarget2d)TextureTarget, Levels, InternalFormat, Width, Layers); CheckError(); }
/// <summary> /// Allocates immutable texture storage with the given parameters. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="width">The width of the texture.</param> /// <param name="height">The height of the texture.</param> /// <param name="samples">The number of samples per texel.</param> /// <param name="fixedSampleLocations">Specifies whether the texels will use identical sample locations.</param> public Texture2DMultisample(SizedInternalFormat internalFormat, int width, int height, int samples, bool fixedSampleLocations) : base(internalFormat, 1) { Width = width; Height = height; Samples = samples; FixedSampleLocations = fixedSampleLocations; GL.BindTexture(TextureTarget, Handle); GL.TexStorage2DMultisample((TextureTargetMultisample2d)TextureTarget, Samples, InternalFormat, Width, Height, FixedSampleLocations); CheckError(); }
/// <summary> /// Allocates immutable texture storage with the given parameters. /// </summary> /// <param name="internalFormat">The internal format to allocate.</param> /// <param name="size">The width and height of the cube map faces.</param> /// <param name="layers">The number of layers to allocate.</param> /// <param name="levels">The number of mipmap levels.</param> public TextureCubemapArray(SizedInternalFormat internalFormat, int size, int layers, int levels = 0) : base(internalFormat, GetLevels(levels, size)) { Size = size; Layers = layers; GL.BindTexture(TextureTarget, Handle); // note: the depth parameter is the number of layer-faces hence the multiplication by six, // see https://www.opengl.org/wiki/Texture_Storage#Immutable_storage GL.TexStorage3D((TextureTarget3d)TextureTarget, Levels, InternalFormat, Size, Size, 6 * Layers); CheckError(); }
internal LayeredTexture(SizedInternalFormat internalFormat, int levels) : base(internalFormat, levels) { }
/// <summary> /// Internal constructor used by <see cref="TextureFactory"/> to wrap a Texture2D instance around an already existing texture. /// </summary> internal Texture2D(int textureHandle, SizedInternalFormat internalFormat, int width, int height, int levels) : base(textureHandle, internalFormat, levels) { Width = width; Height = height; }
/// <summary> /// Initializes a new texture object. Uses the texture handle given.<br/> /// Internal constructor used by <see cref="TextureFactory"/> to wrap a texture instance around an already existing texture. /// </summary> /// <param name="textureHandle">The texture handle.</param> /// <param name="internalFormat">The internal format of the texture.</param> /// <param name="levels">The number of mipmap levels.</param> internal Texture(int textureHandle, SizedInternalFormat internalFormat, int levels) : base(textureHandle) { InternalFormat = internalFormat; Levels = levels; }
public void SetStorage(GPUBuffer storage, SizedInternalFormat internalFormat) { GPUStateMachine.BindTexture(0, TextureTarget.TextureBuffer, id); GL.TexBuffer(TextureBufferTarget.TextureBuffer, internalFormat, storage.id); GPUStateMachine.UnbindTexture(0, TextureTarget.TextureBuffer); }
/// <summary> /// The contents of a texture may be made available for shaders to read and write by binding the texture to one of a collection of image units. /// If the texture identified by texture does not have multiple layers or faces, the entire texture level is bound, regardless of the values specified for layered and layer /// </summary> /// <param name="unit">identifies the image unit [0, MAX_IMAGE_UNITS]</param> /// <param name="TextureID">texture is the name of the texture.If texture is zero, any texture currently bound to image unit unit is unbound.</param> /// <param name="level">selects a single level of the texture.</param> /// <param name="layered"> If layered is TRUE, the entire level is bound. If layered is FALSE, only the single layer identified by layer will be bound</param> /// <param name="layer"></param> /// <param name="access">access specifies whether the texture bound to the image will be treated as READ_ONLY, WRITE_ONLY, or READ_WRITE.</param> /// <param name="format">format specifies the format that the elements of the image will be treated as when doing formatted stores</param> public static void BindImageTexture(uint unit, uint TextureID, int level, MapBufferAccess access, SizedInternalFormat format, bool layered = false, int layer = 0) { Delegates.glBindImageTexture(unit, TextureID, level, layered, layer, access, format); }
public static void TexBuffer(TextureBufferTarget target, SizedInternalFormat internalFormat, uint buffer) { glTexBuffer deleg = BaseGraphicsContext.Current.Loader.Get<glTexBuffer>(); if (deleg != null) deleg(target, internalFormat, buffer); }
/// <summary> /// Initializes a new texture object. Creates a new texture handle. /// </summary> /// <param name="internalFormat">The internal format of the texture.</param> /// <param name="levels">The number of mipmap levels.</param> internal Texture(SizedInternalFormat internalFormat, int levels) : this(GL.GenTexture(), internalFormat, levels) { }
private static void Add(Format format, SizedInternalFormat sif) { TableImage[(int)format] = sif; }