當前位置: 首頁>>代碼示例>>C#>>正文


C# GraphicsDevice.UseOpenGLCreationContext方法代碼示例

本文整理匯總了C#中SiliconStudio.Paradox.Graphics.GraphicsDevice.UseOpenGLCreationContext方法的典型用法代碼示例。如果您正苦於以下問題:C# GraphicsDevice.UseOpenGLCreationContext方法的具體用法?C# GraphicsDevice.UseOpenGLCreationContext怎麽用?C# GraphicsDevice.UseOpenGLCreationContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SiliconStudio.Paradox.Graphics.GraphicsDevice的用法示例。


在下文中一共展示了GraphicsDevice.UseOpenGLCreationContext方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GraphicsDeviceFeatures

        internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot)
        {
            mapFeaturesPerFormat = new FeaturesPerFormat[256];

            IsProfiled = false;

            using (deviceRoot.UseOpenGLCreationContext())
            {
                Vendor = GL.GetString(StringName.Vendor);
                Renderer = GL.GetString(StringName.Renderer);
#if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
                SupportedExtensions = GL.GetString(StringName.Extensions).Split(' ');
#else
                int numExtensions;
                GL.GetInteger(GetPName.NumExtensions, out numExtensions);
                SupportedExtensions = new string[numExtensions];
                for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex)
                {
                    SupportedExtensions[extensionIndex] = GL.GetString(StringName.Extensions, extensionIndex);
                }
#endif
            }

#if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
            var isOpenGLES3 = deviceRoot.versionMajor >= 3;

            deviceRoot.HasDepth24 = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_depth24");
            deviceRoot.HasPackedDepthStencilExtension = SupportedExtensions.Contains("GL_OES_packed_depth_stencil");
            deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888")
                                       || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888");
            deviceRoot.HasRenderTargetFloat = SupportedExtensions.Contains("GL_EXT_color_buffer_float");
            deviceRoot.HasRenderTargetHalf = SupportedExtensions.Contains("GL_EXT_color_buffer_half_float");
            deviceRoot.HasVAO = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_vertex_array_object");

            // Compute shaders available in OpenGL ES 3.1
            HasComputeShaders = isOpenGLES3 && deviceRoot.versionMinor >= 1;
            HasDoublePrecision = false;
            
            // TODO: from 3.1: draw indirect, separate shader object
            // TODO: check tessellation & geometry shaders: GL_ANDROID_extension_pack_es31a
#else
            deviceRoot.HasVAO = true;

            // Compute shaders available in OpenGL 4.3
            HasComputeShaders = deviceRoot.versionMajor >= 4 && deviceRoot.versionMinor >= 3;
            HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit");

            // TODO: from 4.0: tessellation, draw indirect
            // TODO: from 4.1: separate shader object
#endif
            
            HasDriverCommandLists = false;
            HasMultiThreadingConcurrentResources = false;

            // TODO: Enum supported formats in mapFeaturesPerFormat

            // Find shader model based on OpenGL version (might need to check extensions more carefully)
            Profile = OpenGLUtils.GetFeatureLevel(deviceRoot.versionMajor, deviceRoot.versionMinor);
        }
開發者ID:Powerino73,項目名稱:paradox,代碼行數:59,代碼來源:GraphicsDeviceFeatures.OpenGL.cs


注:本文中的SiliconStudio.Paradox.Graphics.GraphicsDevice.UseOpenGLCreationContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。