BindSampler() public static method

public static BindSampler ( uint target, uint sampler ) : void
target uint
sampler uint
return void
Ejemplo n.º 1
0
        /// <summary>
        /// texture's settings.
        /// </summary>
        /// <param name="unit">OpenGL.GL_TEXTURE0 etc.</param>
        /// <param name="target"></param>
        public override void Bind(uint unit, TextureTarget target)
        {
            if (!this.initialized)
            {
                this.Initialize(unit, target);
            }

            OpenGL.BindSampler(unit, this.Id);
        }
Ejemplo n.º 2
0
        private void DoInitialize(uint unit, TextureTarget target)
        {
            var ids = new uint[1];

            OpenGL.GenSamplers(1, ids);
            this.Id = ids[0];
            //OpenGL.BindSampler(unit, ids[0]);
            OpenGL.BindSampler(unit, ids[0]);
            /* Clamping to edges is important to prevent artifacts when scaling */
            OpenGL.SamplerParameteri(ids[0], OpenGL.GL_TEXTURE_WRAP_R, (int)this.parameters.wrapR);
            OpenGL.SamplerParameteri(ids[0], OpenGL.GL_TEXTURE_WRAP_S, (int)this.parameters.wrapS);
            OpenGL.SamplerParameteri(ids[0], OpenGL.GL_TEXTURE_WRAP_T, (int)this.parameters.wrapT);
            /* Linear filtering usually looks best for text */
            OpenGL.SamplerParameteri(ids[0], OpenGL.GL_TEXTURE_MIN_FILTER, (int)this.parameters.minFilter);
            OpenGL.SamplerParameteri(ids[0], OpenGL.GL_TEXTURE_MAG_FILTER, (int)this.parameters.magFilter);
            // TODO: mipmap not used yet.

            OpenGL.BindSampler(unit, 0);
        }