Beispiel #1
0
        protected override void PlatformSetTexture(int slot, ShaderTextureBinding textureBinding)
        {
            OpenGLESTextureBinding         glTextureBinding = (OpenGLESTextureBinding)textureBinding;
            OpenGLESTextureBindingSlotInfo info             = ShaderResourceBindingSlots.GetTextureBindingInfo(slot);

            _textureSamplerManager.SetTexture(info.RelativeIndex, glTextureBinding);
            ShaderSet.UpdateTextureUniform(info.UniformLocation, info.RelativeIndex);
        }
        public void SetTexture(int textureUnit, OpenGLESTextureBinding texture)
        {
            if (_textureUnitTextures[textureUnit] != texture)
            {
                GL.ActiveTexture(TextureUnit.Texture0 + textureUnit);
                Utilities.CheckLastGLES3Error();
                GL.BindTexture(texture.BoundTexture.Target, texture.BoundTexture.ID);
                Utilities.CheckLastGLES3Error();

                EnsureSamplerMipmapState(textureUnit, texture.BoundTexture.MipLevels > 1);
                _textureUnitTextures[textureUnit] = texture;
            }
        }
        public void SetSampler(int textureUnit, OpenGLESSamplerState samplerState)
        {
            if (_textureUnitSamplers[textureUnit].SamplerState != samplerState)
            {
                bool mipmapped = false;
                OpenGLESTextureBinding texBinding = _textureUnitTextures[textureUnit];
                if (texBinding != null)
                {
                    mipmapped = texBinding.BoundTexture.MipLevels > 1;
                }

                samplerState.Apply(textureUnit, mipmapped);
                _textureUnitSamplers[textureUnit] = new BoundSamplerStateInfo(samplerState, mipmapped);
            }
            else if (_textureUnitTextures[textureUnit] != null)
            {
                EnsureSamplerMipmapState(textureUnit, _textureUnitTextures[textureUnit].BoundTexture.MipLevels > 1);
            }
        }