Ejemplo n.º 1
0
        internal static bool SupportsOpenGLPreview()
        {
            bool supported = false;

            try
            {
                lock (OpenGlPreviewForm.ContextLock)
                {
                    var control = new GLControl();
                    control.MakeCurrent();
                    var major = GL.GetInteger(GetPName.MajorVersion);
                    var minor = GL.GetInteger(GetPName.MinorVersion);
                    if (major > 3 || (major == 3 && minor >= 3))
                    {
                        Logging.Info($"Open GL version supported!. {major}.{minor}");
                        supported = true;
                    }
                    else
                    {
                        Logging.Error($"Open GL version not supported. {major}.{minor}");
                    }

                    control.Context.MakeCurrent(null);
                    control.Dispose();
                }
            }
            catch (Exception e)
            {
                Logging.Error(e, "An error occurred testing for OpenGL support.");
            }

            return(supported);
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            if (m_View != null)
            {
                m_View.BufferSwapNotify += OnBufferSwapNotify;
            }

            m_GLControl.Dispose();
        }
Ejemplo n.º 3
0
 public void Destroy()
 {
     GL.DeleteTexture(textureName);
     GL.DeleteTexture(charTextureName);
     if (glControl != null)
     {
         glControl.Visible = false;
         glControl.Dispose();
     }
 }
Ejemplo n.º 4
0
 public void Cleanup()
 {
     foreach (var dl in _displayLists.Values)
     {
         dl.Dispose();
     }
     _leftTickBar.Dispose();
     _bottomTickBar.Dispose();
     _glcontrol.Dispose();
 }
Ejemplo n.º 5
0
        public void Release()
        {
            if (defaultBlack != null)
            {
                defaultBlack.Release();
                defaultBlack = null;
            }

            if (defaultWhite != null)
            {
                defaultWhite.Release();
                defaultWhite = null;
            }

            if (defaultGray != null)
            {
                defaultGray.Release();
                defaultGray = null;
            }

            if (defaultDarkGray != null)
            {
                defaultDarkGray.Release();
                defaultDarkGray = null;
            }

            HdriManager.Release();

            if (mat != null)
            {
                mat.Release();
                mat = null;
            }

            if (sphere != null)
            {
                sphere.Release();
                sphere = null;
            }

            if (cube != null)
            {
                cube.Release();
                cube = null;
            }

            if (glview != null)
            {
                FHost.Child = null;
                glview.Dispose();
                glview = null;
            }
        }
Ejemplo n.º 6
0
        public void Release()
        {
            if (quad != null)
            {
                quad.Release();
                quad = null;
            }

            if (glview != null)
            {
                glview.Dispose();
                glview      = null;
                FHost.Child = null;
            }
        }
Ejemplo n.º 7
0
        public void Dispose()
        {
            Console.WriteLine("Disposing renderer");

            Loaded = false;

            InputTimer.Dispose();
            meshControl.Dispose();
            cameraLabel.Dispose();
            fpsLabel.Dispose();
            animationBox.Dispose();
            cameraBox.Dispose();

            if (renderModeComboBox != null)
            {
                renderModeComboBox.Dispose();
            }
        }
        private void DisposeOpenGLControl()
        {
            Controls.Remove(glControl1);

            glControl1.Dispose();

            glControl1.Paint  -= GlControl1_Paint;
            glControl1.Resize -= GlControl1_SizeChanged;
            //glControl1.KeyDown += glControl1_KeyDown;
            //glControl1.KeyPress += glControl1_KeyPress;
            //glControl1.KeyUp += glControl1_KeyUp;
            //glControl1.MouseClick += glControl1_MouseClick;
            glControl1.MouseDoubleClick -= GlControl1_MouseDoubleClick;
            glControl1.MouseDown        -= GlControl1_MouseDown;
            glControl1.MouseMove        -= GlControl1_MouseMove;
            glControl1.MouseUp          -= GlControl1_MouseUp;
            glControl1.MouseWheel       -= GlControl1_MouseWheel;

            glControl1.Load     += GlControl1_Load;
            glControl1.Disposed += GlControl1_Disposed;
        }
Ejemplo n.º 9
0
        public void RecreateSceneControl()
        {
            GLControl
                oldControl = GetSceneControl(),
                newControl = new GLControl();
            var parent     = oldControl.Parent;

            newControl.BackColor = Scene.BackgroundColour;
            newControl.Dock      = DockStyle.Fill;
            newControl.Location  = new System.Drawing.Point(0, 0);
            newControl.Name      = "SceneControl";
            newControl.Size      = new System.Drawing.Size(100, 100);
            newControl.TabIndex  = 1;
            newControl.VSync     = Scene.VSync;
            parent.SuspendLayout();
            SceneCon.Connect(false);
            parent.Controls.Remove(oldControl);
            parent.Controls.Add(newControl);
            SceneCon.Connect(true);
            RenderCon.Refresh();
            parent.ResumeLayout();
            oldControl.Dispose();
        }