View Full Version : Evenly spaced objects with OpenGL

11-10-2012, 11:30 PM
I'm developing a small charting control that displays time series data using OpenGL. I'm programming in C++ in Visual Studio.
My control works great. I can zoom, and scroll data using glOrtho. The one problem I have is when I draw rectangles representing some
data every increment in the time series they are not evenly spaced which is not visually appealling (see pic).

I convert my data to floats and display using the following code. Should I use doubles or map my data to pixels using int?
Any suggestions or help is greatly appreciated, thanks.

// increment 't' to represent the next point in the time series
float TIMESHIFT = 0.2f;

glVertex2f( t - TIMESHIFT, 0.0);
glVertex2f( t + TIMESHIFT, 0.0);
glVertex2f( t + TIMESHIFT, y);
glVertex2f( t - TIMESHIFT, y);

http://imageshack.us/a/img844/1256/ogl2.png (http://imageshack.us/photo/my-images/844/ogl2.png/)