Ejemplo n.º 1
0
        public static void DrawPolygon(Point3d[] points, Point3d[] textureCoords, string textureName)
        {
            PickTexture(textureName);
            Gl.glBegin(Gl.GL_POLYGON);
            for (int i = 0; i <= points.Length - 1; i++)
            {
                if (textureCoords[i] != null)
                {
                    Gl.glTexCoord3d(textureCoords[i].X, textureCoords[i].Y, textureCoords[i].Z);
                }

                Gl.glVertex3d(points[i].X, points[i].Y, points[i].Z);
            }
            DrawingService.UnloadTexture();
            Gl.glEnd();
        }
Ejemplo n.º 2
0
        public static void DrawRim(Point3d p1, Point3d p2, double size = 1, double radius = 1,
                                   string textureName = null)
        {
            for (int i = 360; i >= 1; i--)
            {
                if (textureName != null)
                {
                    DrawingService.PickTexture(textureName);
                }

                Gl.glBegin(Gl.GL_POLYGON);
                double x1 = Math.Cos(Angle3d.DegreeToRadian(i));
                double y1 = Math.Sin(Angle3d.DegreeToRadian(i));
                double x2 = Math.Cos(Angle3d.DegreeToRadian(i - 3));
                double y2 = Math.Sin(Angle3d.DegreeToRadian(i - 3));

                Gl.glNormal3d(x1, y1, y1);
                Gl.glTexCoord3d(x2, 0, 0);
                //Gl.glNormal3b(0, 1, 0);
                Gl.glVertex3d(x2 * size + p2.X, y2 * radius + p2.Y, y2 * radius + p2.Z);

                Gl.glNormal3d(x1, y1, y1);
                Gl.glTexCoord3d(x2, 1, 0);
                //Gl.glNormal3b(0, 1, 0);
                Gl.glVertex3d(x2 * size + p1.X, y2 * radius + p1.Y, y2 * radius + p1.Z);

                Gl.glNormal3d(x1, y1, y1);
                Gl.glTexCoord3d(x1, 1, 0);
                //Gl.glNormal3b(0, 1, 0);
                Gl.glVertex3d(x1 * size + p1.X, y1 * radius + p1.Y, y1 * radius + p1.Z);

                Gl.glNormal3d(x1, y1, y1);
                Gl.glTexCoord3d(x1, 0, 0);
                //Gl.glNormal3b(0, 1, 0);
                Gl.glVertex3d(x1 * size + p2.X, y1 * radius + p2.Y, y1 * radius + p2.Z);
                Gl.glEnd();
                DrawingService.UnloadTexture();
            }
        }