Esempio n. 1
0
        public override void DrawEllipse(PBrush c, float width, RectangleF rect)
        {
            const int DETAIL = 50;

            float x  = (rect.Left + rect.Right) / 2f;
            float y  = (rect.Top + rect.Bottom) / 2f;
            float rx = (rect.Right - rect.Left) / 2f;
            float ry = (rect.Bottom - rect.Top) / 2f;
            float w  = 1 - width * 2f / (rx + ry);

            if (c != null)
            {
                GL.Color(c.GetColor());
            }
            GL.Begin(PrimitiveType.QUADS);
            double lA = 0;

            for (int i = 1; i <= DETAIL; i++)
            {
                double  a    = i * Math.PI * 2.0 / DETAIL;
                float   sin1 = (float)Math.Sin(lA);
                float   cos1 = (float)Math.Cos(lA);
                float   sin2 = (float)Math.Sin(a);
                float   cos2 = (float)Math.Cos(a);
                float[] ptsx = new float[] { cos1, cos1 *w, cos2 *w, cos2 };
                float[] ptsy = new float[] { sin1, sin1 *w, sin2 *w, sin2 };
                NativeGL.nglVertex2fTrans(4, ptsx, ptsy, x, y, rx, ry);
                lA = a;
            }
            GL.End();
        }
Esempio n. 2
0
        public override void FillEllipse(PBrush c, RectangleF rect)
        {
            float x  = (rect.Left + rect.Right) / 2f;
            float y  = (rect.Top + rect.Bottom) / 2f;
            float rx = (rect.Right - rect.Left) / 2f;
            float ry = (rect.Bottom - rect.Top) / 2f;

            if (c != null)
            {
                GL.Color(c.GetColor());
            }
            GL.Begin(PrimitiveType.TRIANGLES);
            NativeGL.nglVertex2fTrans(pEllipseX.Length, pEllipseX, pEllipseY, x, y, rx, ry);
            GL.End();
        }
Esempio n. 3
0
 public override void Circle(float x, float y, float r)
 {
     NativeGL.nglVertex2fTrans(pEllipseX.Length, pEllipseX, pEllipseY,
                               x, y, r, r);
 }