Example #1
0
        /// <summary>
        /// Creates a new texture object and fills it with given image data.
        /// </summary>
        /// <param name="width">Target Width.</param>
        /// <param name="height">Target Height.</param>
        /// <param name="data">Image data for the texture to be filled with.</param>
        /// <param name="clamp">If set to <c>true</c> the texture will be clamped at the edges.</param>
        private void CreateTexture(int width, int height, byte[] data, bool clamp)
        {
            var flags = (int)ETextureFlags.FT_NOMIPS;

            if (_isRenderTarget)
            {
                flags |= (int)ETextureFlags.FT_DONT_STREAM | (int)ETextureFlags.FT_DONT_RELEASE | (int)ETextureFlags.FT_USAGE_RENDERTARGET;
            }
            _nativeTexture = Global.gEnv.pRenderer.CreateTexture(_originalName, width, height, 1, data, (byte)ETEX_Format.eTF_R8G8B8A8, flags);
            _nativeTexture.SetClamp(clamp);
            _isClamped = clamp;
            _nativeTexture.AddRef();

            _texId = _nativeTexture.GetTextureID();
        }
Example #2
0
        /// <summary>
        /// Creates a new texture object and fills it with given image data.
        /// </summary>
        /// <param name="width">Target Width.</param>
        /// <param name="height">Target Height.</param>
        /// <param name="data">Image data for the texture to be filled with.</param>
        void CreateTexture(int width, int height, byte[] data)
        {
            Width  = width;
            Height = height;
            var flags = (int)ETextureFlags.FT_NOMIPS;

            if (_isRendertarget)
            {
                flags = (int)ETextureFlags.FT_DONT_STREAM | (int)ETextureFlags.FT_DONT_RELEASE | (int)ETextureFlags.FT_USAGE_RENDERTARGET;
            }
            _ceTex = Global.gEnv.pRenderer.CreateTexture("MF", Width, Height, 1, data, (byte)ETEX_Format.eTF_R8G8B8A8, flags);
            _ceTex.SetClamp(false);
            _ceTex.SetHighQualityFiltering(_isFiltered);

            _texId = _ceTex.GetTextureID();
        }
Example #3
0
 private Texture(ITexture nativeTexture)
 {
     _isRenderTarget = ((ETextureFlags)nativeTexture.GetFlags()).HasFlag(ETextureFlags.FT_USAGE_RENDERTARGET);
     _texId          = nativeTexture.GetTextureID();
     nativeTexture.AddRef();
 }