I have a problem where I have to read in some 3 dimensional coordinates and translate those to 2 dimensional and draw the resulting points. I don't have a problem doing that, but I also have to constrain the drawing area and window to the resulting set of points.
In one example, the minimum X value is 0.12 and the maximum is 0.78. The minimum Y value is 0.109 and the maximum is 0.571. Basically I want these coordinates to define the view size - that is, I want these coordinates to be translated to pixels and take up the whole window. xPercent and yPercent are supposed to be an additional 5% margin around the whole thing. All these values are calculated correctly, I think I'm just using GL.Ortho incorrectly (or possibly not even using the correct thing). I've attached an image of what is currently showing up. There are many more points that are going out of the window and the "highest" point needs to be closer to the top of the window.
Yes, this is homework, but the teacher is instructing in C and I'd like to do the assignments in C#. This is the only part I need help with and I've been searching for hours.
This code is in my OnRenderFrame method.
GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(xMin - xPercent, xMax + xPercent, yMin - yPercent, yMax + yPercent, -1.0, 1.0);
I figured it out. I was using GL.Ortho correctly, I just wasn't resetting a value correctly in one of my loops.