OSDN Git Service

RAD-288: Add option in preferences to disable use of VBO even if hardware claims...
authorLatif Khalifa <latifer@streamgrid.net>
Sun, 4 Sep 2011 19:10:21 +0000 (19:10 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Sun, 4 Sep 2011 19:10:21 +0000 (19:10 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@1129 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Dialogs/Settings.cs
Radegast/GUI/Rendering/GraphicsPreferences.Designer.cs
Radegast/GUI/Rendering/GraphicsPreferences.cs
Radegast/GUI/Rendering/Rendering.cs

index 8513d00..ee45006 100644 (file)
@@ -109,8 +109,11 @@ namespace Radegast
 
             if (!s.ContainsKey("rendering_occlusion_culling_enabled")) s["rendering_occlusion_culling_enabled"] = true;
 
+            if (!s.ContainsKey("rendering_use_vbo")) s["rendering_use_vbo"] = true;
+
             if (!s.ContainsKey("send_rad_client_tag")) s["send_rad_client_tag"] = true;
 
+
         }
 
         public frmSettings(RadegastInstance instance)
index 5c5e397..94c6c00 100644 (file)
@@ -35,6 +35,7 @@
             this.cbWaterReflections = new System.Windows.Forms.CheckBox();
             this.cbOcclusionCulling = new System.Windows.Forms.CheckBox();
             this.cbShiny = new System.Windows.Forms.CheckBox();
+            this.cbVBO = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.tbDrawDistance)).BeginInit();
             this.SuspendLayout();
             // 
             // cbOcclusionCulling
             // 
             this.cbOcclusionCulling.AutoSize = true;
-            this.cbOcclusionCulling.Location = new System.Drawing.Point(3, 72);
+            this.cbOcclusionCulling.Location = new System.Drawing.Point(169, 3);
             this.cbOcclusionCulling.Name = "cbOcclusionCulling";
             this.cbOcclusionCulling.Size = new System.Drawing.Size(107, 17);
-            this.cbOcclusionCulling.TabIndex = 4;
+            this.cbOcclusionCulling.TabIndex = 5;
             this.cbOcclusionCulling.Text = "Occlusion Culling";
             this.cbOcclusionCulling.UseVisualStyleBackColor = true;
             this.cbOcclusionCulling.CheckedChanged += new System.EventHandler(this.cbOcclusionCulling_CheckedChanged);
             // cbShiny
             // 
             this.cbShiny.AutoSize = true;
-            this.cbShiny.Location = new System.Drawing.Point(3, 95);
+            this.cbShiny.Location = new System.Drawing.Point(3, 72);
             this.cbShiny.Name = "cbShiny";
             this.cbShiny.Size = new System.Drawing.Size(52, 17);
-            this.cbShiny.TabIndex = 5;
+            this.cbShiny.TabIndex = 4;
             this.cbShiny.Text = "Shiny";
             this.cbShiny.UseVisualStyleBackColor = true;
             this.cbShiny.CheckedChanged += new System.EventHandler(this.cbShiny_CheckedChanged);
             // 
+            // cbVBO
+            // 
+            this.cbVBO.AutoSize = true;
+            this.cbVBO.Location = new System.Drawing.Point(169, 26);
+            this.cbVBO.Name = "cbVBO";
+            this.cbVBO.Size = new System.Drawing.Size(70, 17);
+            this.cbVBO.TabIndex = 6;
+            this.cbVBO.Text = "Use VBO";
+            this.cbVBO.UseVisualStyleBackColor = true;
+            this.cbVBO.CheckedChanged += new System.EventHandler(this.cbVBO_CheckedChanged);
+            // 
             // GraphicsPreferences
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.cbVBO);
             this.Controls.Add(this.cbShiny);
             this.Controls.Add(this.cbOcclusionCulling);
             this.Controls.Add(this.cbWaterReflections);
         public System.Windows.Forms.CheckBox cbWaterReflections;
         private System.Windows.Forms.CheckBox cbOcclusionCulling;
         private System.Windows.Forms.CheckBox cbShiny;
+        private System.Windows.Forms.CheckBox cbVBO;
     }
 }
index 59205e4..91cedfc 100644 (file)
@@ -80,6 +80,7 @@ namespace Radegast.Rendering
             }
             cbOcclusionCulling.Checked = Instance.GlobalSettings["rendering_occlusion_culling_enabled"];
             cbShiny.Checked = Instance.GlobalSettings["scene_viewer_shiny"];
+            cbVBO.Checked = Instance.GlobalSettings["rendering_use_vbo"];
         }
 
         void GraphicsPreferences_Disposed(object sender, EventArgs e)
@@ -152,5 +153,15 @@ namespace Radegast.Rendering
                 }
             }
         }
+
+        private void cbVBO_CheckedChanged(object sender, EventArgs e)
+        {
+            Instance.GlobalSettings["rendering_use_vbo"] = cbVBO.Checked;
+            if (Window != null)
+            {
+                RenderSettings.UseVBO = cbVBO.Checked &&
+                    (RenderSettings.ARBQuerySupported || RenderSettings.CoreQuerySupported);
+            }
+        }
     }
 }
index 7646e17..74dfa66 100644 (file)
@@ -670,7 +670,8 @@ namespace Radegast.Rendering
                 // VBO\r
                 RenderSettings.ARBVBOPresent = context.GetAddress("glGenBuffersARB") != IntPtr.Zero;\r
                 RenderSettings.CoreVBOPresent = context.GetAddress("glGenBuffers") != IntPtr.Zero;\r
-                RenderSettings.UseVBO = RenderSettings.ARBVBOPresent || RenderSettings.CoreVBOPresent;\r
+                RenderSettings.UseVBO = (RenderSettings.ARBVBOPresent || RenderSettings.CoreVBOPresent)\r
+                    && instance.GlobalSettings["rendering_use_vbo"];\r
 \r
                 // Occlusion Query\r
                 RenderSettings.ARBQuerySupported = context.GetAddress("glGetQueryObjectivARB") != IntPtr.Zero;\r