public static void DrawGrid3D(int gridStep, WorldTransform w, float z, Color lineColor, Color textColor, Color radiiColor) { GLUtility.DisableNiceLines(); GLPen pen = new GLPen(lineColor, 1.0f); pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); for (int i = (int)w.WorldLowerLeft.Y; i < w.WorldUpperRight.Y; i++) { if (i % gridStep == 0) { Gl.glVertex3f((float)w.WorldLowerLeft.X, i, z); Gl.glVertex3f((float)w.WorldUpperRight.X, i, z); //GLUtility.DrawString(i.ToString() + "m", new Font("verdana", 1), textColor, new PointF(0, i + .25f)); } } for (int i = (int)w.WorldLowerLeft.X; i < w.WorldUpperRight.X; i++) { if (i % gridStep == 0) { Gl.glVertex3f(i, (float)w.WorldLowerLeft.Y, z); Gl.glVertex3f(i, (float)w.WorldUpperRight.Y, z); //GLUtility.DrawString(i.ToString() + "m", new Font("verdana", 1), textColor, new PointF(i, (float)(w.WorldUpperRight.Y - w.WorldLowerLeft.Y) / 2.0f)); } } Gl.glEnd(); GLUtility.EnableNiceLines(); }
public static void DrawWireframeBox3D(v3f a, v3f b, GLPen pen) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(b.x, a.y, a.z); Gl.glVertex3f(a.x, b.y, a.z); Gl.glVertex3f(b.x, b.y, a.z); Gl.glVertex3f(a.x, a.y, b.z); Gl.glVertex3f(b.x, a.y, b.z); Gl.glVertex3f(a.x, b.y, b.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(a.x, b.y, a.z); Gl.glVertex3f(a.x, a.y, b.z); Gl.glVertex3f(a.x, b.y, b.z); Gl.glVertex3f(b.x, a.y, a.z); Gl.glVertex3f(b.x, b.y, a.z); Gl.glVertex3f(b.x, a.y, b.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(a.x, a.y, b.z); Gl.glVertex3f(b.x, a.y, a.z); Gl.glVertex3f(b.x, a.y, b.z); Gl.glVertex3f(a.x, b.y, a.z); Gl.glVertex3f(a.x, b.y, b.z); Gl.glVertex3f(b.x, b.y, a.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glEnd(); }
public static void DrawLine3D(GLPen pen, float aX, float aY, float aZ, float bX, float bY, float bZ) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(aX, aY, aZ); Gl.glVertex3f(bX, bY, bZ); Gl.glEnd(); }
public static void DrawLine(GLPen pen, PointF p1, PointF p2) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_STRIP); Gl.glVertex2f(p1.X, p1.Y); Gl.glVertex2f(p2.X, p2.Y); Gl.glEnd(); }
public static void DrawPoint3D(GLPen pen, v3f p) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_POINT); //Gl.glVertex3f(p.x, p.y, 0.0f);//p.z); Gl.glVertex2f(p.x, p.y); Gl.glEnd(); }
public static void DrawCircle(GLPen p, PointF center, float radius) { p.GLApplyPen(); Gl.glPushMatrix(); Gl.glTranslatef(center.X, center.Y, 0); GLUtility.DrawEllipse(p, new RectangleF(-radius, -radius, radius * 2, radius * 2)); Gl.glPopMatrix(); }
public static void DrawLine3D(GLPen pen, v3f a, v3f b) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glEnd(); }
public static void DrawPoint(GLPen pen, PointF p, bool ApplyPen) { if (ApplyPen) { pen.GLApplyPen(); } Gl.glBegin(Gl.GL_POINT); Gl.glVertex2f(p.X, p.Y); Gl.glEnd(); }
public static void DrawLines(GLPen pen, PointF[] points) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_STRIP); foreach (PointF p in points) { Gl.glVertex2f(p.X, p.Y); } Gl.glEnd(); }
public static void DrawCross3D(GLPen pen, v3f p, float size) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(p.x + size, p.y, p.z); Gl.glVertex3f(p.x - size, p.y, p.z); Gl.glVertex3f(p.x, p.y + size, p.z); Gl.glVertex3f(p.x, p.y - size, p.z); Gl.glVertex3f(p.x, p.y, p.z + size); Gl.glVertex3f(p.x, p.y, p.z - size); Gl.glEnd(); }
public static void DrawEllipse(GLPen p, RectangleF rect) { p.GLApplyPen(); Gl.glPushMatrix(); Gl.glTranslatef(rect.Left + rect.Width / 2, rect.Top + rect.Height / 2, 0); Gl.glBegin(Gl.GL_LINE_LOOP); for (double i = 0; i < Math.PI * 2; i += 0.05) { Gl.glVertex2f((float)(Math.Cos(i) * rect.Width / 2), (float)(Math.Sin(i) * rect.Height / 2)); } Gl.glEnd(); Gl.glPopMatrix(); }
public static void DrawRectangle(GLPen pen, RectangleF rect) { PointF p1 = new PointF(rect.Left, rect.Top); PointF p2 = new PointF(rect.Right, rect.Top); PointF p3 = new PointF(rect.Right, rect.Bottom); PointF p4 = new PointF(rect.Left, rect.Bottom); pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_LOOP); Gl.glVertex2f(p1.X, p1.Y); Gl.glVertex2f(p2.X, p2.Y); Gl.glVertex2f(p3.X, p3.Y); Gl.glVertex2f(p4.X, p4.Y); Gl.glEnd(); }
public static void DrawCube(GLPen pen, v3f p, float size) { pen.GLApplyPen(); Gl.glPushMatrix(); Gl.glTranslatef(p.x, p.y, p.z); Gl.glScalef(size, size, size); Gl.glBegin(Gl.GL_QUADS); // Front Face Gl.glNormal3f(0.0f, 0.0f, 1.0f); Gl.glVertex3f(-1.0f, -1.0f, 1.0f); Gl.glVertex3f(1.0f, -1.0f, 1.0f); Gl.glVertex3f(1.0f, 1.0f, 1.0f); Gl.glVertex3f(-1.0f, 1.0f, 1.0f); // Back Face Gl.glNormal3f(0.0f, 0.0f, -1.0f); Gl.glVertex3f(-1.0f, -1.0f, -1.0f); Gl.glVertex3f(-1.0f, 1.0f, -1.0f); Gl.glVertex3f(1.0f, 1.0f, -1.0f); Gl.glVertex3f(1.0f, -1.0f, -1.0f); // Top Face Gl.glNormal3f(0.0f, 1.0f, 0.0f); Gl.glVertex3f(-1.0f, 1.0f, -1.0f); Gl.glVertex3f(-1.0f, 1.0f, 1.0f); Gl.glVertex3f(1.0f, 1.0f, 1.0f); Gl.glVertex3f(1.0f, 1.0f, -1.0f); // Bottom Face Gl.glNormal3f(0.0f, -1.0f, 0.0f); Gl.glVertex3f(-1.0f, -1.0f, -1.0f); Gl.glVertex3f(1.0f, -1.0f, -1.0f); Gl.glVertex3f(1.0f, -1.0f, 1.0f); Gl.glVertex3f(-1.0f, -1.0f, 1.0f); // Right face Gl.glNormal3f(1.0f, 0.0f, 0.0f); Gl.glVertex3f(1.0f, -1.0f, -1.0f); Gl.glVertex3f(1.0f, 1.0f, -1.0f); Gl.glVertex3f(1.0f, 1.0f, 1.0f); Gl.glVertex3f(1.0f, -1.0f, 1.0f); // Left Face Gl.glNormal3f(-1.0f, 0.0f, 0.0f); Gl.glVertex3f(-1.0f, -1.0f, -1.0f); Gl.glVertex3f(-1.0f, -1.0f, 1.0f); Gl.glVertex3f(-1.0f, 1.0f, 1.0f); Gl.glVertex3f(-1.0f, 1.0f, -1.0f); Gl.glEnd(); Gl.glPopMatrix(); }
public static void DrawBezier(GLPen pen, PointF startP, PointF ctrl1, PointF ctrl2, PointF endP) { CubicBezier cb = new CubicBezier(Utility.ToCoord(startP), Utility.ToCoord(ctrl1), Utility.ToCoord(ctrl2), Utility.ToCoord(endP)); pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_STRIP); //iterate this bitch for (double i = 0; i < 1.0; i += .025) { PointF p = Utility.ToPointF(cb.Bt(i)); Gl.glVertex2f(p.X, p.Y); } PointF p1 = Utility.ToPointF(cb.Bt(1)); Gl.glVertex2f(p1.X, p1.Y); Gl.glEnd(); }
public static void DrawCube(GLPen pen, v3f p, float size) { pen.GLApplyPen(); Gl.glPushMatrix(); Gl.glTranslatef(p.x, p.y, p.z); Gl.glScalef(size, size, size); Gl.glBegin(Gl.GL_QUADS); // Front Face Gl.glNormal3f(0.0f, 0.0f, 1.0f); Gl.glVertex3f(-1.0f, -1.0f, 1.0f); Gl.glVertex3f(1.0f, -1.0f, 1.0f); Gl.glVertex3f(1.0f, 1.0f, 1.0f); Gl.glVertex3f(-1.0f, 1.0f, 1.0f); // Back Face Gl.glNormal3f(0.0f, 0.0f, -1.0f); Gl.glVertex3f(-1.0f, -1.0f, -1.0f); Gl.glVertex3f(-1.0f, 1.0f, -1.0f); Gl.glVertex3f(1.0f, 1.0f, -1.0f); Gl.glVertex3f(1.0f, -1.0f, -1.0f); // Top Face Gl.glNormal3f(0.0f, 1.0f, 0.0f); Gl.glVertex3f(-1.0f, 1.0f, -1.0f); Gl.glVertex3f(-1.0f, 1.0f, 1.0f); Gl.glVertex3f(1.0f, 1.0f, 1.0f); Gl.glVertex3f(1.0f, 1.0f, -1.0f); // Bottom Face Gl.glNormal3f(0.0f, -1.0f, 0.0f); Gl.glVertex3f(-1.0f, -1.0f, -1.0f); Gl.glVertex3f(1.0f, -1.0f, -1.0f); Gl.glVertex3f(1.0f, -1.0f, 1.0f); Gl.glVertex3f(-1.0f, -1.0f, 1.0f); // Right face Gl.glNormal3f(1.0f, 0.0f, 0.0f); Gl.glVertex3f(1.0f, -1.0f, -1.0f); Gl.glVertex3f(1.0f, 1.0f, -1.0f); Gl.glVertex3f(1.0f, 1.0f, 1.0f); Gl.glVertex3f(1.0f, -1.0f, 1.0f); // Left Face Gl.glNormal3f(-1.0f, 0.0f, 0.0f); Gl.glVertex3f(-1.0f, -1.0f, -1.0f); Gl.glVertex3f(-1.0f, -1.0f, 1.0f); Gl.glVertex3f(-1.0f, 1.0f, 1.0f); Gl.glVertex3f(-1.0f, 1.0f, -1.0f); Gl.glEnd(); Gl.glPopMatrix(); }
public static void DrawEllipse(GLPen p, RectangleF rect) { p.GLApplyPen(); Gl.glPushMatrix(); Gl.glTranslatef(rect.Left+rect.Width /2, rect.Top + rect.Height /2 , 0); Gl.glBegin(Gl.GL_LINE_LOOP); for (double i = 0; i < Math.PI * 2; i += 0.05) Gl.glVertex2f((float)(Math.Cos(i) * rect.Width/2), (float)(Math.Sin(i) * rect.Height/2)); Gl.glEnd(); Gl.glPopMatrix(); }
public static void DrawGrid3D(int gridStep, WorldTransform w, float z, Color lineColor, Color textColor, Color radiiColor) { GLUtility.DisableNiceLines(); GLPen pen = new GLPen(lineColor, 1.0f); pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); for (int i = (int)w.WorldLowerLeft.Y; i < w.WorldUpperRight.Y; i++) { if (i % gridStep == 0) { Gl.glVertex3f((float)w.WorldLowerLeft.X, i, z); Gl.glVertex3f((float)w.WorldUpperRight.X, i, z); //GLUtility.DrawString(i.ToString() + "m", new Font("verdana", 1), textColor, new PointF(0, i + .25f)); } } for (int i = (int)w.WorldLowerLeft.X; i < w.WorldUpperRight.X; i++) { if (i % gridStep == 0) { Gl.glVertex3f(i,(float)w.WorldLowerLeft.Y,z); Gl.glVertex3f(i, (float)w.WorldUpperRight.Y, z); //GLUtility.DrawString(i.ToString() + "m", new Font("verdana", 1), textColor, new PointF(i, (float)(w.WorldUpperRight.Y - w.WorldLowerLeft.Y) / 2.0f)); } } Gl.glEnd(); GLUtility.EnableNiceLines(); }
public static void DrawLine(GLPen pen, PointF p1, PointF p2) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_STRIP); Gl.glVertex2f(p1.X, p1.Y); Gl.glVertex2f(p2.X, p2.Y); Gl.glEnd(); }
public static void DrawLine3D(GLPen pen, v3f a, v3f b) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glEnd(); }
public static void DrawRectangle(GLPen pen, RectangleF rect) { PointF p1 = new PointF (rect.Left, rect.Top); PointF p2 = new PointF (rect.Right, rect.Top); PointF p3 = new PointF(rect.Right, rect.Bottom); PointF p4 = new PointF(rect.Left, rect.Bottom); pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_LOOP); Gl.glVertex2f(p1.X, p1.Y); Gl.glVertex2f(p2.X, p2.Y); Gl.glVertex2f(p3.X, p3.Y); Gl.glVertex2f(p4.X, p4.Y); Gl.glEnd(); }
public static void DrawLines(GLPen pen, PointF[] points) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_STRIP); foreach (PointF p in points) Gl.glVertex2f(p.X, p.Y); Gl.glEnd(); }
public static void DrawPoint(GLPen pen, PointF p, bool ApplyPen) { if (ApplyPen) pen.GLApplyPen(); Gl.glBegin(Gl.GL_POINT); Gl.glVertex2f(p.X, p.Y); Gl.glEnd(); }
public static void DrawCircle(GLPen p, PointF center, float radius) { p.GLApplyPen(); Gl.glPushMatrix(); Gl.glTranslatef(center.X, center.Y, 0); GLUtility.DrawEllipse(p, new RectangleF(-radius, -radius, radius * 2, radius*2)); Gl.glPopMatrix(); }
public static void DrawWireframeBox3D(v3f a, v3f b, GLPen pen) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(b.x, a.y, a.z); Gl.glVertex3f(a.x, b.y, a.z); Gl.glVertex3f(b.x, b.y, a.z); Gl.glVertex3f(a.x, a.y, b.z); Gl.glVertex3f(b.x, a.y, b.z); Gl.glVertex3f(a.x, b.y, b.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(a.x, b.y, a.z); Gl.glVertex3f(a.x, a.y, b.z); Gl.glVertex3f(a.x, b.y, b.z); Gl.glVertex3f(b.x, a.y, a.z); Gl.glVertex3f(b.x, b.y, a.z); Gl.glVertex3f(b.x, a.y, b.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glVertex3f(a.x, a.y, a.z); Gl.glVertex3f(a.x, a.y, b.z); Gl.glVertex3f(b.x, a.y, a.z); Gl.glVertex3f(b.x, a.y, b.z); Gl.glVertex3f(a.x, b.y, a.z); Gl.glVertex3f(a.x, b.y, b.z); Gl.glVertex3f(b.x, b.y, a.z); Gl.glVertex3f(b.x, b.y, b.z); Gl.glEnd(); }
public static void DrawCross3D(GLPen pen, v3f p, float size) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(p.x + size, p.y, p.z); Gl.glVertex3f(p.x - size, p.y, p.z); Gl.glVertex3f(p.x, p.y + size, p.z); Gl.glVertex3f(p.x, p.y - size, p.z); Gl.glVertex3f(p.x, p.y, p.z + size); Gl.glVertex3f(p.x, p.y, p.z - size); Gl.glEnd(); }
public static void DrawLine3D(GLPen pen, float aX, float aY, float aZ, float bX, float bY, float bZ) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINES); Gl.glVertex3f(aX, aY, aZ); Gl.glVertex3f(bX, bY, bZ); Gl.glEnd(); }
public static void DrawBezier(GLPen pen, PointF startP, PointF ctrl1, PointF ctrl2, PointF endP) { CubicBezier cb = new CubicBezier(Utility.ToCoord(startP), Utility.ToCoord(ctrl1), Utility.ToCoord(ctrl2), Utility.ToCoord(endP)); pen.GLApplyPen(); Gl.glBegin(Gl.GL_LINE_STRIP); //iterate this bitch for (double i = 0; i < 1.0; i += .025) { PointF p = Utility.ToPointF(cb.Bt(i)); Gl.glVertex2f(p.X, p.Y); } PointF p1 = Utility.ToPointF(cb.Bt(1)); Gl.glVertex2f(p1.X, p1.Y); Gl.glEnd(); }
public static void DrawPoint3D(GLPen pen, v3f p) { pen.GLApplyPen(); Gl.glBegin(Gl.GL_POINT); //Gl.glVertex3f(p.x, p.y, 0.0f);//p.z); Gl.glVertex2f(p.x, p.y); Gl.glEnd(); }