Hello Dark Photon,
Thank your taking the time to post. Here is the fundamental problem. 3D graphics are beyond my knowledge level. Hopefully, 2D is not. My goal is a 2D display. I have the paperback book referenced in hand. Thank you for the link to the soft copy, it has already been helpful.
In the referenced chapter 3 the example code contains:
glLoadIdentity (); /* clear the matrix */
The word “the” in the context of the comment implies that there is one specific matrix being addressed. Ok. Which matrix is that? The author presumes that the reader already knows. Just below in the text is:
In this code example, before the viewing transformation can be specified, the current matrix is set to the identity matrix with glLoadIdentity().
I searched this document, then searched chapters 2 and 1. This is the first use of the phrase: “the current matrix.” It is not defined. Exactly what is this current matrix? Is there a one and only current matrix? Or is the current matrix selected from a set of matrices? I suspect the latter. The author presumes the reader already knows.
To become what I phrase as: fluent in open GL, would require a year or more of studying linear algebra and matrix mathematics. I have no desire to do that. I only need to create a simple 2D strip chart.
While I have two urgent questions experience indicates I should concentrate on one at a time. I presume that you, dear reader, are familiar with a strip chart. The X axis represents time, always moving, the Y axis represents the value of a selected measurement. Every measurement to be displayed falls naturally into the X/Y coordinate system as time/value. To my knowledge, so far, I see two fundamental methods of presenting the always scrolling X axis.
The first method is to use the current time to develop the two X values for function glOrtho(). The first two arguments of that function are left_clip and right_clip values. If I keep those two arguments, say, 10 seconds apart, and increment them, say, 10 times a second by having a 100 millisecond timer, the X values will always represent the latest 10 seconds of time. That means that glOrtho() is called 10 times a second with new values to the left and right clip values on each call. That is expected to result in the plotted Y values marching across the monitor.
The second method is to set glOrtho() one time. The time/value pairs must then have their X coordinates shifted within each of the 10 updates a second to cause the value points to march across the screen.
As I write this I recognize a third possible method, about which I know practically nothing. Use a matrix transformation. That can shift a display matrix along any or multiple axes. I am only concerned with shifting the X axis. From my readings I conclude that Open GL can assign this task to the video display device which can do it far faster than the general purpose CPU. Beyond that, I haven’t a clue.
From my very limited perspective, shifting the arguments for glOrtho makes the most sense. It always keeps the right time associated with the value of each measurement. I can then use gl_Begin( GL_LINE_STRIP ) and just plot all the points within the desired time frame.
Is this a satisfactory method, a great method, or maybe the worst?