public void ReplaceRenderableObject(RenderableObject o, bool clearPrevious) { try { this.PointCloud = o.PointCloud; // if (clearPrevious) // ClearAll(); if (GLContextInitialized) { //System.Diagnostics.Debug.WriteLine("--Replace renderable object"); if (this.RenderableObjects.Count > 0) { RenderableObject oldObject = RenderableObjects[0]; //oldObject.Dispose(); oldObject.PointCloud = o.PointCloud; //o.InitializeGL(); } else { o.InitializeGL(); RenderableObjects.Add(o); } Refresh(); } } catch (Exception err) { System.Windows.Forms.MessageBox.Show("Error in OpenGLContext.ReplaceRenderableObject : " + err.Message); } }
public void AddRenderableObject(RenderableObject o) { RenderableObjects.Add(o); if (GLContextInitialized) { o.InitializeGL(); Refresh(); } }