Exemplo n.º 1
0
        /// <summary>
        /// Get the closest supported alternative format. If format is supported, returns format.
        /// </summary>
        /// <param name="format"></param>
        /// <returns></returns>
        public virtual PixelFormat GetSupportedAlternative(PixelFormat format)
        {
            if (CheckFormat(format))
            {
                return(format);
            }
            /// Find first alternative
            PixelComponentType pct = PixelUtil.GetComponentType(format);

            switch (pct)
            {
            case PixelComponentType.Byte:
                format = PixelFormat.A8R8G8B8;
                break;

            case PixelComponentType.Short:
                format = PixelFormat.SHORT_RGBA;
                break;

            case PixelComponentType.Float16:
                format = PixelFormat.FLOAT16_RGBA;
                break;

            case PixelComponentType.Float32:
                format = PixelFormat.FLOAT32_RGBA;
                break;
            }
            if (CheckFormat(format))
            {
                return(format);
            }

            /// If none at all, return to default
            return(PixelFormat.A8R8G8B8);
        }
Exemplo n.º 2
0
 /// <summary>
 /// </summary>
 /// <param name="name"> </param>
 /// <param name="target"> </param>
 /// <param name="writeGamma"> </param>
 /// <param name="fsaa"> </param>
 public GLESPBRenderTexture(GLESPBRTTManager manager, string name, GLESSurfaceDescription target, bool writeGamma, int fsaa)
     : base(name, target, writeGamma, fsaa)
 {
     this._manager  = manager;
     this._pbFormat = PixelUtil.GetComponentType(target.Buffer.Format);
     this._manager.RequestPBuffer(this._pbFormat, Width, Height);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Get PBuffer component format for an OGRE pixel format.
 /// </summary>
 /// <param name="fmt"></param>
 /// <returns></returns>
 public static PixelComponentType GetPixelComponentType(PixelFormat fmt)
 {
     return(PixelUtil.GetComponentType(fmt));
 }
Exemplo n.º 4
0
        public override bool IsHardwareFilteringSupported(TextureType ttype, PixelFormat format, TextureUsage usage,
                                                          bool preciseFormatOnly)
#endif
        {
            if (format == PixelFormat.Unknown)
            {
                return(false);
            }

            // Check natively format
            PixelFormat nativeFormat = GetNativeFormat(ttype, format, usage);

            if (preciseFormatOnly && format != nativeFormat)
            {
                return(false);
            }

            // Assume non-floating point is supported always
            if (!PixelUtil.IsFloatingPoint(nativeFormat))
            {
                return(true);
            }

            // Hack: there are no elegant GL API to detects texture filtering supported,
            // just hard code for cards based on vendor specifications.

            // TODO: Add cards that 16 bits floating point flitering supported by
            // hardware below
            String[] sFloat16SupportedCards =
            {
                // GeForce 8 Series
                "*GeForce*8800*",                   // GeForce 7 Series
                "*GeForce*7950*", "*GeForce*7900*", "*GeForce*7800*", "*GeForce*7600*",
                "*GeForce*7500*", "*GeForce*7300*", // GeForce 6 Series
                "*GeForce*6800*", "*GeForce*6700*", "*GeForce*6600*", "*GeForce*6500*",
                "*GeForce*6200*", ""                // Empty string means end of list
            };

            // TODO: Add cards that 32 bits floating point flitering supported by
            // hardware below
            String[] sFloat32SupportedCards =
            {
                // GeForce 8 Series
                "*GeForce*8800*", ""                                                                                 // Empty string means end of list
            };

            PixelComponentType pct = PixelUtil.GetComponentType(nativeFormat);

            String[] supportedCards;
            switch (pct)
            {
            case PixelComponentType.Float16:
                supportedCards = sFloat16SupportedCards;
                break;

            case PixelComponentType.Float32:
                supportedCards = sFloat32SupportedCards;
                break;

            default:
                return(false);
            }
            String pcRenderer = Gl.glGetString(Gl.GL_RENDERER);               // TAO 2.0

            //String pcRenderer = Marshal.PtrToStringAnsi( Gl.glGetString( Gl.GL_RENDERER ) );

            foreach (String str in supportedCards)
            {
                if (str == pcRenderer)
                {
                    return(true);
                }
            }

            return(false);
        }