Beispiel #1
0
        /// <summary>
        /// Binds the given <see cref="TextureCubeMap"/> to the GraphicsDevice at the given texture unit location.
        /// </summary>
        /// <param name="slot">The texture unit slot that the texture will be bound to.</param>
        /// <param name="textureCubeMap">The <see cref="TextureCubeMap"/> to bind.</param>
        public void BindTextureCubeMap(int slot, TextureCubeMap textureCubeMap)
        {
            if (slot < 0 || slot >= GLInfo.MaxTextureImageUnits)
            {
                throw new ArgumentOutOfRangeException(nameof(slot));
            }

            if (textureCubeMap == null)
            {
                throw new ArgumentNullException(nameof(textureCubeMap));
            }

            textureCubeMap.EnsureUndisposed();

            SetActiveTextureSlot(slot);

            if (_textureUnits[slot].TextureCubeMapHandle == textureCubeMap.Handle)
            {
                return;
            }

            ClearOtherTextureTypes(slot, ManaTextureType.TextureCubeMap);

            GL.BindTexture(TextureTarget.TextureCubeMap, textureCubeMap.Handle);

            _boundTextureType = ManaTextureType.TextureCubeMap;
            _textureUnits[slot].TextureCubeMapHandle        = textureCubeMap.Handle;
            _textureUnits[slot].TextureCubeMap              = textureCubeMap;
            _textureUnits[slot].TextureCubeMap.BoundContext = this;
        }