I'm quite new on SharpGL (OpenGl) and I'm trying to draw some squares and add some text inside. I use the code below.
The Problem is, gl.DrawText3D method translates by itself according to text lenght. When I wanted to add a new line that starts from the left edge of square, the second line's start point doesn't match with the first line.
What I am looking for is:
1) if there is way of preventing DrawText3d method to translate
or
2) to find how much it's translated by this method.
public void addPlc(PLCTreeNode plc,int level)
{
OpenGL gl = openGLControl.OpenGL;
gl.Translate(plc.level * 6, -6, 0);
gl.PushMatrix();
setColor(plc.plcColor);
drawSquare();
if (!isFirt)
{
setColor(plc.LineColor);
drawLine(-3, 4 + level * 6, -3, 2, 12);
}
isFirt = false;
gl.Translate(-3.9, 1, 0);
setColor(0);
// Where text is written.
gl.DrawText3D("Arial", 25, 2, 0.1f, plc.plcId + " - " + plc.slaveCount+"\n"+plc.lastInfoTime.ToString("s").Replace('T', ' '));
//translate assumpstion is 7.0f but it is not always
gl.Translate(-7, -1, 0);
// setColor(0);
gl.DrawText3D("Arial", 25, 2, 0.1f, plc.lastInfoTime.ToString("s").Replace('T', ' '));
gl.PopMatrix();
gl.Translate(plc.level * -6, 0, 0);