Пример #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);
        }
Пример #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);
        }