Пример #1
0
 public void ChangeCurrentSector(Sector newSector)
 {
     if (sector == newSector)
     {
         return;                     //ignore when there is no change
     }
     this.sector = newSector;
     PathToEdit  = null;
     SectorChanged(level, newSector);
     if (CurrentRenderer != null)
     {
         if (show_background1.Active)
         {
             CurrentRenderer.SetBackgroundColor(new Drawing.Color(1, 1, 1, 1));
         }
         else
         {
             CurrentRenderer.SetBackgroundColor(new Drawing.Color(1, 1, 1, 0));
         }
         // If there is no tool activated for this sector yet reset it to the Select tool.
         if (CurrentRenderer.Editor == null)
         {
             OnToolSelect(null, null);
             ToolSelect.Active = true;
         }
     }
 }
Пример #2
0
 protected void OnShowBackground(object o, EventArgs e)
 {
     if (CurrentRenderer == null)
     {
         show_background1.Active = true;
         return;
     }
     CurrentRenderer.SetBackgroundColor(new Drawing.Color(1, 1, 1, (show_background1.Active?1:0)));
 }
Пример #3
0
        /// <summary>
        /// Query the OpenGL version. Requires some information lookup functions to be bound.
        /// </summary>
        /// <returns>The version of the current OpenGL context.</returns>
        private static KhronosVersion QueryContextVersionInternal()
        {
            // Parse version string (effective for detecting Desktop and ES contextes)
            string         str       = GetString(StringName.Version);
            KhronosVersion glVersion = KhronosVersion.Parse(str);

            // Vendor/Render information
            CurrentVendor    = GetString(StringName.Vendor);
            CurrentRenderer  = GetString(StringName.Renderer);
            SoftwareRenderer = CurrentRenderer.Contains("llvmpipe");

            // Context profile
            if (glVersion.Api == KhronosVersion.API_GL && glVersion >= Version320)
            {
                string glProfile;

                Get(CONTEXT_PROFILE_MASK, out int ctxProfile);

                if ((ctxProfile & CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0)
                {
                    glProfile = KhronosVersion.PROFILE_COMPATIBILITY;
                }
                else if ((ctxProfile & CONTEXT_CORE_PROFILE_BIT) != 0)
                {
                    glProfile = KhronosVersion.PROFILE_CORE;
                }
                else
                {
                    glProfile = KhronosVersion.PROFILE_COMPATIBILITY;
                }

                return(new KhronosVersion(glVersion, glProfile));
            }
            else
            {
                string profile = KhronosVersion.PROFILE_COMPATIBILITY;
                if (CurrentRenderer.Contains("WebGL"))
                {
                    profile = KhronosVersion.PROFILE_WEBGL;
                }
                return(new KhronosVersion(glVersion, profile));
            }
        }