示例#1
0
        internal virtual void InitializeExtensions()
        {
            //Set version string
            var pcVer = GL.GetString(OpenTK.Graphics.ES20.All.Version);

            if (pcVer == null || pcVer.Length == 0)
            {
                pcVer = "UNKOWN";
            }
            string tmpStr = pcVer;

            LogManager.Instance.Write("GL_VERSION = " + tmpStr);
            int spacePos = -1;

            for (int i = 0; i < tmpStr.Length; i++)
            {
                if (tmpStr[i] == ' ')
                {
                    spacePos = i;
                    break;
                }
            }
            if (spacePos != -1)
            {
                this._version = tmpStr.Substring(0, spacePos);
            }
            else if (tmpStr.Contains(' '))
            {
                this._version = tmpStr.Remove(' ');
            }
            else
            {
                this._version = tmpStr;
            }
            //Get vendor
            tmpStr = GL.GetString(OpenTK.Graphics.ES20.All.Vendor);
            if (tmpStr == null || tmpStr == string.Empty)
            {
                tmpStr = "UNKOWN";
            }

            LogManager.Instance.Write("GL_VENDOR = " + tmpStr);
            spacePos = -1;
            for (int i = 0; i < tmpStr.Length; i++)
            {
                if (tmpStr[i] == ' ')
                {
                    spacePos = i;
                    break;
                }
            }
            if (spacePos != -1)
            {
                this._vendor = tmpStr.Substring(0, spacePos);
            }
            else if (tmpStr.Contains(' '))
            {
                this._vendor = tmpStr.Remove(' ');
            }
            else
            {
                this._vendor = tmpStr;
            }
            //Get renderer
            tmpStr = GL.GetString(OpenTK.Graphics.ES20.All.Vendor);
            if (tmpStr == null || tmpStr == string.Empty)
            {
                tmpStr = "UNKOWN";
            }

            LogManager.Instance.Write("GL_RENDERER = " + tmpStr);

            //Set extension list

            var pcExt = GL.GetString(OpenTK.Graphics.ES20.All.Extensions);

            if (pcExt == null)
            {
                pcExt = string.Empty;
            }

            LogManager.Instance.Write("GL_EXTENSIONS = " + pcExt);
            this.ExtensionList = pcExt;
        }