PDA

View Full Version : Moving points in memory



09-22-2000, 09:38 AM
I am displaying 1600 pts across by 240 lines. When new data comes in I have to shift all current data in the window down to display the new data. The oldest data disappears.

Currently, I am brute forcing the shift in a loop, temp[i+1] = data[i]. Is there a fast way to implement this shift in OpenGL?

DFrey
09-22-2000, 10:42 AM
Nope, I don't think I ever remember seeing an OpenGL function or extension that supported hardware scrolling. I think you will simply need to optimize the method you use to draw the points. I'd use a fixed 2D array and keep track of which line the new data is written to, wrapping that line counter (call it i for example) back to 0 once it goes above the top of the array. Then to draw the array, start with line i+1, and proceed to draw all lines of the array (again wrapping the line count to 0 when it overflows the array). This way, no extra shifting has to be done. The drawing order will make them appear to shift.