public static void DrawPlate3D(double xpos, double ypos, double xang, double yang, double zang, RGBAColor col) { glColor4d(col.Mix(col, new RGBAColor(0, 0, 0, 1), 0.2)); Gl.glPushMatrix(); Gl.glTranslated(xpos, ypos, 0.7); Gl.glRotated(xang, 1, 0, 0); Gl.glRotated(yang, 0, 1, 0); Gl.glRotated(zang, 0, 0, 1); Gl.glScaled(0.7, 0.1, 0.7); Glut.glutSolidCube(1); Gl.glLineWidth(2); glColor4d(col); Glut.glutWireCube(1); Gl.glPopMatrix(); }
public static void glColor4d(RGBAColor col) { Gl.glColor4d(col.R, col.G, col.B, col.A); }
public static void DrawEMGChannel(RectangleBox rect, double x, double y, RGBAColor col, ref CyclicBuffer <PanelEMGData> buf, int ch, bool drawlabel = false, double depth = -1.0) { List <PanelLabel> pl = new List <PanelLabel>(); List <double> plx = new List <double>(); double origdepth = currentdepth; UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(rect.left + x, rect.bottom, currentdepth); glColor4d(col); //Gl.glPolygonMode(Gl.GL_FRONT, Gl.GL_LINE); Gl.glBegin(Gl.GL_TRIANGLE_STRIP); for (int i = 0; i < buf.maxlen; i++) { byte amp = buf[i].amp[ch]; double xpos = (double)i / (buf.maxlen - 3) * rect.Width; //width+INTERMID if (drawlabel) { foreach (var lab in buf[i].labels) { pl.Add(lab); plx.Add(xpos); break; } } else { glColor4d(col); } Gl.glVertex2d(xpos, y + (amp > 0?0:0) + 0.1 * amp); Gl.glVertex2d(xpos, y - (amp > 0?0:0) - 0.1 * amp); } Gl.glEnd(); Gl.glLineWidth(1); Gl.glPopMatrix(); if (drawlabel) { for (int i = 0; i < pl.Count; i++) { UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(rect.left + x + plx[i], rect.bottom, origdepth + 0.001 / 2); Gl.glLineWidth(pl[i].bold); glColor4d(pl[i].col); Gl.glBegin(Gl.GL_LINES); Gl.glVertex2d(0, 0); Gl.glVertex2d(0, rect.Height); Gl.glEnd(); Gl.glLineWidth(1); Gl.glBegin(Gl.GL_LINE_STRIP); Gl.glVertex2d(0, 0 + 15); Gl.glVertex2d(7, 7 + 15); Gl.glVertex2d(30, 7 + 15); Gl.glVertex2d(30, -7 + 15); Gl.glVertex2d(7, -7 + 15); Gl.glVertex2d(0, 0 + 15); Gl.glEnd(); Gl.glTranslated(10, 12, 0.0); Gl.glScaled(0.07, 0.07, 1.0); foreach (char c in pl[i].label) { Gl.glTranslated(10, 0.0, 0.0); Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, c); } Gl.glPopMatrix(); } } }
public static void DrawChannelLabel(RectangleBox rect, double x, double y, RGBAColor col, string text, bool selected, double depth = -1.0) { UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(rect.left, rect.bottom, currentdepth); Gl.glLineWidth(1); Gl.glTranslated(x, y, 0); glColor4d(new RGBAColor(0, 0, 0, 1)); Gl.glBegin(Gl.GL_TRIANGLE_FAN); Gl.glVertex2d(0, 0); Gl.glVertex2d(-7, 7); Gl.glVertex2d(-30, 7); Gl.glVertex2d(-30, -7); Gl.glVertex2d(-7, -7); Gl.glVertex2d(0, 0); Gl.glEnd(); Gl.glPopMatrix(); UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(rect.left, rect.bottom, currentdepth); Gl.glTranslated(x, y, 0); glColor4d(col); if (selected) { Gl.glBegin(Gl.GL_TRIANGLE_FAN); } else { Gl.glBegin(Gl.GL_LINE_STRIP); } Gl.glVertex2d(0, 0); Gl.glVertex2d(-7, 7); Gl.glVertex2d(-30, 7); Gl.glVertex2d(-30, -7); Gl.glVertex2d(-7, -7); Gl.glVertex2d(0, 0); Gl.glEnd(); Gl.glPopMatrix(); UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(rect.left, rect.bottom, currentdepth); Gl.glTranslated(x - 26, y - 3, 0); Gl.glScaled(0.07, 0.07, 1.0); if (selected) { glColor4d(new RGBAColor(0, 0, 0, 1)); } else { glColor4d(col); } Gl.glLineWidth(1); foreach (char c in text) { Gl.glTranslated(3, 0.0, 0.0); Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, c); } Gl.glPopMatrix(); }
public static void DrawCaption(double height, double x, double y, String caption, RGBAColor col, double depth = -1.0) { UpdateDepth(depth); Gl.glPushMatrix(); double width = 30 + height + 8 * caption.Length; Gl.glTranslated(x, y, currentdepth); glColor4d(col); Gl.glBegin(Gl.GL_TRIANGLE_FAN); Gl.glVertex2d(0, 0); Gl.glVertex2d(width, 0); Gl.glVertex2d(width - height, height); Gl.glVertex2d(0, height); Gl.glEnd(); Gl.glPopMatrix(); UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(x + 10.0, y + height * 0.22, currentdepth); Gl.glScaled(0.10, 0.10, 1.0); glColor4d(new RGBAColor(1, 1, 1, 1)); Gl.glLineWidth(1); foreach (char c in caption) { Gl.glTranslated(10, 0.0, 0.0); Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, c); } Gl.glPopMatrix(); }
public static void DrawPieMark(RectangleBox rect, double xpos, double ypos, double size, double percent, RGBAColor col, string text, double depth = -1.0, bool bold = false) { UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(rect.left, rect.bottom, currentdepth); Gl.glPushMatrix(); Gl.glTranslated(xpos, ypos, 0); glColor4d(col); if (bold) { Gl.glLineWidth(2); } Gl.glBegin(Gl.GL_LINE_STRIP); for (int i = 0; i <= 32; i++) { Gl.glVertex2d(-size * Math.Sin((double)i / 32 * 2 * Math.PI), size * Math.Cos((double)i / 32 * 2 * Math.PI)); } Gl.glEnd(); Gl.glLineWidth(1); glColor4d(col.Fade(0.5)); Gl.glBegin(Gl.GL_TRIANGLE_FAN); Gl.glVertex2d(0, 0); for (int i = 0; i <= 32 * percent; i++) { Gl.glVertex2d(-0.8 * size * Math.Sin((double)i / 32 * 2 * Math.PI), 0.8 * size * Math.Cos((double)i / 32 * 2 * Math.PI)); } Gl.glEnd(); Gl.glPopMatrix(); DrawString(xpos - 5, ypos - 5, text, new RGBAColor(1, 1, 1, 1)); Gl.glPopMatrix(); }
public static void DrawEffectExcitation(RectangleBox rect, RGBAColor col, double intensity, double depth = -1.0) { //no effects for you }