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(); }
static public void DrawBoldText(int x, int y, string text, IntPtr font) { Gl.glRasterPos2f(x, y); for (int i = 0; i < text.Length; i++) { Glut.glutStrokeCharacter(font, text[i]); } }
static void strokeString(string str, double x, double y, double z, double s) { int i, n; n = str.Length; Gl.glPushMatrix(); Gl.glTranslated(x, y - 119.05 * 0.5 * s, z); Gl.glScaled(s, s, s); for (i = 0; i < n; i++) { Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, (int)str[i]); } Gl.glPopMatrix(); }
public static void DrawString(double x, double y, string str, RGBAColor col, double depth = -1.0) { UpdateDepth(depth); Gl.glPushMatrix(); Gl.glTranslated(x, y, currentdepth); Gl.glScaled(0.10, 0.10, 1.0); Gl.glLineWidth(1); Gl.glColor3d(col.R, col.G, col.B); foreach (char c in str) { Gl.glTranslated(10, 0.0, 0.0); Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, c); } Gl.glPopMatrix(); }
public static void PrintGL(double x, double y, string str, double size = 5) { Gl.glPushMatrix(); Gl.glTranslated(x, y, 0); Gl.glLineWidth((float)(0.2 * size)); double sz = 0.005f * size; Gl.glScaled(sz, sz, sz); for (int c = 0; c < str.Length; c++) { Glut.glutStrokeCharacter(Glut.GLUT_STROKE_ROMAN, (int)str[c]); } Gl.glPopMatrix(); }
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(); }