Example #1
0
        /// <summary>
        /// Create a TextureArray2d, defining the texture size (for level 0) and the internal format.
        /// </summary>
        /// <param name="width">
        /// A <see cref="UInt32"/> that specify the texture width, in pixels.
        /// </param>
        /// <param name="height">
        /// A <see cref="UInt32"/> that specify the texture height, in pixels.
        /// </param>
        /// <param name="layers">
        /// A <see cref="UInt32"/> that specify the number of layers defining the texture array.
        /// </param>
        /// <param name="format">
        /// A <see cref="PixelLayout"/> determining the texture internal format.
        /// </param>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="width"/> or <paramref name="height"/> is zero.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="format"/> equals to <see cref="PixelLayout.None"/>.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// Exception thrown if no context is current to the calling thread.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="width"/> or <paramref name="height"/> is greater than
        /// the maximum allowed for 2D textures.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if NPOT texture are not supported by current context, and <paramref name="width"/> or <paramref name="height"/>
        /// is not a power-of-two value.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="format"/> is not a supported internal format.
        /// </exception>
        public void Create(uint width, uint height, uint layers, PixelLayout format)
        {
            Technique technique;

            if (Immutable)
            {
                technique = new ImmutableEmptyTechnique(this, TextureTarget, format, width, height, layers);
            }
            else
            {
                technique = new EmptyTechnique(this, TextureTarget, format, width, height, layers, 0);
            }

            SetTechnique(technique);
        }
Example #2
0
        /// <summary>
        /// Create a Texture2D, defining the texture extents and the internal format.
        /// </summary>
        /// <param name="width">
        /// A <see cref="UInt32"/> that specify the texture width.
        /// </param>
        /// <param name="height">
        /// A <see cref="UInt32"/> that specify the texture height.
        /// </param>
        /// <param name="format">
        /// A <see cref="PixelLayout"/> determining the texture internal format.
        /// </param>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="width"/> or <paramref name="height"/> is zero.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="format"/> equals to <see cref="PixelLayout.None"/>.
        /// </exception>
        /// <exception cref="InvalidOperationException">
        /// Exception thrown if no context is current to the calling thread.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="width"/> or <paramref name="height"/> is greater than
        /// the maximum allowed for 2D textures.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if NPOT texture are not supported by current context, and <paramref name="width"/> or <paramref name="height"/>
        /// is not a power-of-two value.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// Exception thrown if <paramref name="format"/> is not a supported internal format.
        /// </exception>
        public void Create(uint width, uint height, PixelLayout format, uint levels)
        {
            if (ImmutableFix)
            {
                throw new InvalidOperationException("immutable storage (see GL_ARB_texture_storage)");
            }

            Technique technique;

            if (Immutable)
            {
                technique = new ImmutableEmptyTechnique(this, TextureTarget, format, width, height, levels);
            }
            else
            {
                technique = new EmptyTechnique(this, TextureTarget, 0, format, width, height);
            }

            SetTechnique(technique);
        }