Example #1
0
 public static TextureSampler CreateTexture2DSampler(
     TextureMinificationFilter minificationFilter,
     TextureMagnificationFilter magnificationFilter,
     TextureWrap wrapS,
     TextureWrap wrapT)
 {
     return(new TextureSamplerGL3x(
                minificationFilter,
                magnificationFilter,
                wrapS,
                wrapT,
                1));
 }
Example #2
0
 protected TextureSampler(
     TextureMinificationFilter minificationFilter,
     TextureMagnificationFilter magnificationFilter,
     TextureWrap wrapS,
     TextureWrap wrapT,
     float maximumAnistropy)
 {
     _minificationFilter = minificationFilter;
     _magnificationFilter = magnificationFilter;
     _wrapS = wrapS;
     _wrapT = wrapT;
     _maximumAnistropy = maximumAnistropy;
 }
Example #3
0
 protected TextureSampler(
     TextureMinificationFilter minificationFilter,
     TextureMagnificationFilter magnificationFilter,
     TextureWrap wrapS,
     TextureWrap wrapT,
     float maximumAnistropy)
 {
     _minificationFilter  = minificationFilter;
     _magnificationFilter = magnificationFilter;
     _wrapS            = wrapS;
     _wrapT            = wrapT;
     _maximumAnistropy = maximumAnistropy;
 }
Example #4
0
        public static TextureMagFilter To(TextureMagnificationFilter filter)
        {
            switch (filter)
            {
            case TextureMagnificationFilter.Nearest:
                return(TextureMagFilter.Nearest);

            case TextureMagnificationFilter.Linear:
                return(TextureMagFilter.Linear);
            }

            throw new ArgumentException("filter");
        }
Example #5
0
 public static TextureSampler CreateTexture2DSampler(
     TextureMinificationFilter minificationFilter,
     TextureMagnificationFilter magnificationFilter,
     TextureWrap wrapS,
     TextureWrap wrapT,
     float maximumAnistropy)
 {
     return(new TextureSamplerGL3x(
                minificationFilter,
                magnificationFilter,
                wrapS,
                wrapT,
                maximumAnistropy));
 }
Example #6
0
        public TextureSamplerGL3x(
            TextureMinificationFilter minificationFilter,
            TextureMagnificationFilter magnificationFilter,
            TextureWrap wrapS,
            TextureWrap wrapT,
            float maximumAnistropy)
            : base(
                minificationFilter,
                magnificationFilter,
                wrapS,
                wrapT,
                maximumAnistropy)
        {
            _name = new SamplerNameGL3x();

            int glMinificationFilter  = (int)TypeConverterGL3x.To(minificationFilter);
            int glMagnificationFilter = (int)TypeConverterGL3x.To(magnificationFilter);
            int glWrapS = (int)TypeConverterGL3x.To(wrapS);
            int glWrapT = (int)TypeConverterGL3x.To(wrapT);

            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureMinFilter, ref glMinificationFilter);
            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureMagFilter, ref glMagnificationFilter);
            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureWrapS, ref glWrapS);
            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureWrapT, ref glWrapT);

            if (Device.Extensions.AnisotropicFiltering)
            {
                GL.SamplerParameter(_name.Value, (ArbSamplerObjects)All.TextureMaxAnisotropyExt, maximumAnistropy);
            }
            else
            {
                if (maximumAnistropy != 1)
                {
                    throw new InsufficientVideoCardException("Anisotropic filtering is not supported.  The extension GL_EXT_texture_filter_anisotropic was not found.");
                }
            }
        }
        public TextureSamplerGL3x(
            TextureMinificationFilter minificationFilter,
            TextureMagnificationFilter magnificationFilter,
            TextureWrap wrapS,
            TextureWrap wrapT,
            float maximumAnistropy)
            : base(
                minificationFilter, 
                magnificationFilter, 
                wrapS, 
                wrapT, 
                maximumAnistropy)
        {
            _name = new SamplerNameGL3x();

            int glMinificationFilter = (int)TypeConverterGL3x.To(minificationFilter);
            int glMagnificationFilter = (int)TypeConverterGL3x.To(magnificationFilter);
            int glWrapS = (int)TypeConverterGL3x.To(wrapS);
            int glWrapT = (int)TypeConverterGL3x.To(wrapT);

            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureMinFilter, ref glMinificationFilter);
            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureMagFilter, ref glMagnificationFilter);
            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureWrapS, ref glWrapS);
            GL.SamplerParameterI(_name.Value, (ArbSamplerObjects)All.TextureWrapT, ref glWrapT);

            if (Device.Extensions.AnisotropicFiltering)
            {
                GL.SamplerParameter(_name.Value, (ArbSamplerObjects)All.TextureMaxAnisotropyExt, maximumAnistropy);
            }
            else
            {
                if (maximumAnistropy != 1)
                {
                    throw new InsufficientVideoCardException("Anisotropic filtering is not supported.  The extension GL_EXT_texture_filter_anisotropic was not found.");
                }
            }
        }
        public static TextureMagFilter To(TextureMagnificationFilter filter)
        {
            switch (filter)
            {
                case TextureMagnificationFilter.Nearest:
                    return TextureMagFilter.Nearest;
                case TextureMagnificationFilter.Linear:
                    return TextureMagFilter.Linear;
            }

            throw new ArgumentException("filter");
        }