Ejemplo n.º 1
0
        private void OpenGLControl_OpenGLDraw(object sender, SharpGL.SceneGraph.OpenGLEventArgs args)
        {
            gl = args.OpenGL;

            // Clear The Screen And The Depth Buffer
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
            gl.ClearColor(0, 0, 0, 0);
            // Move Left And Into The Screen
            gl.LoadIdentity();

            gl.LookAt(xEye, yEye, zEye, xCenter, yCenter, zCenter, xup, yup, zup);
            gl.PushMatrix();
            DrawXYPlane();
            gl.ClearColor(0, 0, 0, 0);

            gl.PopMatrix();


            ///Vẽ lại hình dã luu trong listObject

            if (listObject != null)
            {
                foreach (Graphic3D g in listObject)
                {
                    g.Draw(gl);
                }
            }


            ///// Vẽ hình đang chọn
            if (isMouseEnter && isDrawMode && temp != null)
            {
                gl.PushMatrix();
                temp.Draw(gl);
                gl.PopMatrix();
            }
            gl.Flush();
        }
Ejemplo n.º 2
0
Archivo: Form1.cs Proyecto: a-27m/vssdb
        private void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            if (g3d != null)
            {
                SyncViewToGraphics();
                e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

                g3d.Draw(e.Graphics);

                PointF p2d = new PointF();

                #region gorka shape
                if (gorkaPath != null)
                {
                    gorka2d = new PointF[gorkaPath.Length];

                    for (int i = 0; i < gorkaPath.Length; i++)
                    {
                        g3d.Project(ref gorka2d[i], gorkaPath[i]);
                    }

                    e.Graphics.DrawLines(penGorka, gorka2d);
                }
                #endregion

                float r = 2;
                foreach (List <Point3dNode> line in chkpntList)
                {
                    foreach (Point3D p3d in line)
                    {
                        g3d.Project(ref p2d, p3d);
                        e.Graphics.FillEllipse(Brushes.Blue,

                                               p2d.X - r / vpr.zoom, p2d.Y - r / vpr.zoom,
                                               2 * r / vpr.zoom, 2 * r / vpr.zoom);
                    }
                }

                r = 3;
                if (startPos != null)
                {
                    g3d.Project(ref p2d, startPos);
                    e.Graphics.FillEllipse(Brushes.Green,
                                           p2d.X - r / vpr.zoom, p2d.Y - r / vpr.zoom,
                                           2 * r / vpr.zoom, 2 * r / vpr.zoom);
                }

                r = 3;
                if (finishPos != null)
                {
                    g3d.Project(ref p2d, finishPos);
                    e.Graphics.FillEllipse(Brushes.Red,
                                           p2d.X - r / vpr.zoom, p2d.Y - r / vpr.zoom,
                                           2 * r / vpr.zoom, 2 * r / vpr.zoom);
                }

                if (showPath)
                {
                    DrawMyPath(e.Graphics, path, penPath);
                }
                if (showBestPath)
                {
                    DrawMyPath(e.Graphics, bestPath, penBestPath);
                }
            }
        }