mozzis's picture


Graphics Card: GForce 8400M GS
OS: Vista Business 64-bit
C# in Visual Studio 2008 Pro.

The text rendering demos run fine. I am an OpenGL n00b. I cannot figure out how to position the text in my 3D plot, where the coordinate system is 0-centered and uses floating point coordinates (e.g. -2.1 to 3.0) in x, y and z. Now that wgl and glu are gone, I have no way to label the axes on the plot. Please help!


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mozzis's picture

More info: I am drawing a 3D plot in a GLControl in a Form. The data and the grid for the plot display correctly. The drawing code calculates positions for the tick marks on the axes. It draws the axes and the grid and then walks through the major tick mark coords and attempts to draw labels at each one. I use GL.RasterPosition to set the position prior to calling TextPrinter.Print. All of the text shows up as a color blob next to the 0,0,0 position. Thus:

		public void DrawText(Point3D point, string pText)
			int nLen = pText.Length;
			float fWidth = _Parent.ParentView.ClientSize.Width;
			float fHeight = _Parent.ParentView.ClientSize.Height;
			float xpos = (float)point.X * fWidth / _Parent.XSize;
			float ypos = (float)point.Y * fHeight / _Parent.YSize;
			GL.RasterPos3(point.X, point.Y, point.Z);
			GL.Scale(2.0 / fWidth, 2.0 / fHeight, 1);
			tp.Print(pText, _Font, Color.Red);
			GL.Scale(1.0 / (2.0 / fWidth), 1.0 / (2.0 / fHeight), 1);

the Fiddler's picture

GL.RasterPos3 has no effect on TextPrinter.Print. Use GL.Translate instead.