I’ve been working on a program that plots data points using OpenGL. Everything seems to work correctly, but the drawing is a bit slow ( probably due to the fact that I’m drawing about 20,000 points ) but that can’t be helped. I have to draw every data point that I receive from an outside file. But I was hoping that someone knew of something that I can do to speed up the drawing. I’ve thought of drawing to a bitmap first then displaying the bitmap once it’s finished but I’m not sure if that would really buy me anything. Plus, I don’t know how to handle bitmaps on OSs other than Microsoft Windows and this program has to work on multiple platforms. My code is below…there’s nothing fancy here. I’d appreciate any tips.
Thanks in advance.
… enable Depth Buffer in SetUp…
… A for loop goes through a linked list of data records, retrieves the datas X, Y values and sends these values to the function below to draw the point…
// Get supported point size range
glGetFloatv(GL_POINT_SIZE_RANGE, sizes );
// Set initial point size
cursize = sizes;
glPointSize( curSIze );
// Draw points
// Specify the color, point ,and move the Z value up a little
glColor3ub( (GLubyte)red, (GLubyte)green, (GLubyte)blue );
glVertex3f(x, y, z);
z += 0.5f;
// Done drawing points
// Flush drawing commands
…keeps going through the for loop and doing the above until it’s gone through all the data.