Example #1
0
        /// <summary>
        /// Actually create this GraphicsResource resources.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for allocating resources.
        /// </param>
        protected override void CreateObject(GraphicsContext ctx)
        {
            if (ctx == null)
            {
                throw new ArgumentNullException("ctx");
            }

            // Bind this texture
            Bind(ctx);

            // In the case of no technique, texture will exists but it will be undefined

            if (_Technique != null)
            {
                // Create texture using technique
                _Technique.Create(ctx);
                // Technique no more useful: dispose it
                _Technique.Dispose();
                _Technique = null;

                // Generate mipmaps, if requested
                if (_RequiresMipMaps)
                {
                    GenerateMipmaps(ctx);
                }
            }

            // Clear binding point
            Unbind(ctx);
        }
Example #2
0
        /// <summary>
        /// Actually create this GraphicsResource resources.
        /// </summary>
        /// <param name="ctx">
        /// A <see cref="GraphicsContext"/> used for allocating resources.
        /// </param>
        protected override void CreateObject(GraphicsContext ctx)
        {
            CheckCurrentContext(ctx);

            // Bind this texture
            Gl.BindTexture(TextureTarget, ObjectName);
            ctx.Bind(this);

            // In the case of no technique, texture will exists but it will be undefined

            if (_Technique != null)
            {
                // Create texture using technique
                _Technique.Create(ctx);
                // Technique no more useful: dispose it
                _Technique.Dispose();
                _Technique = null;

                // Generate mipmaps, if requested
                if (_RequiresMipMaps)
                {
                    GenerateMipmaps(ctx);
                }
            }

            // Clear binding point
            ctx.Unbind(this);
        }
Example #3
0
        /// <summary>
        /// Set the technique used for creating and updating this Texture.
        /// </summary>
        /// <param name="technique">
        /// The <see cref="Technique"/> that specify the method creating/updating this Texture.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Exception thrown if <paramref name="technique"/> is null.
        /// </exception>
        protected void SetTechnique(Technique technique)
        {
            if (technique == null)
            {
                throw new ArgumentNullException("technique");
            }

            // Set technique
            _Techniques.Add(technique);
        }
Example #4
0
        /// <summary>
        /// Set the technique used for creating this Texture.
        /// </summary>
        /// <param name="technique">
        ///
        /// </param>
        protected void SetTechnique(Technique technique)
        {
            if (technique == null)
            {
                throw new ArgumentNullException("technique");
            }

            // Dispose previous technique, if any
            if (_Technique != null)
            {
                _Technique.Dispose();
            }
            // Replace technique
            _Technique = technique;
        }