0
$\begingroup$

I want to plot complex data points to a window to display. I know how to do it all in one go:

void display() {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 0.0);
point graph[M*N];
glBegin(GL_POINTS);
for (int i = 0; i < M*N; i++) {
    graph[i].x = output[i].x;
    graph[i].y = output[i].y;
    glBegin(GL_POINTS);
    glVertex2f(graph[i].x, graph[i].y);
}
glEnd();
Flush();
}
glutDisplayFunc(display);

Then display it with glutDisplayFunc... is there a way to call this multiple times as in fill the array with vertices and write to the window and do it again and again etc. as many batches of vertices as you want. I tried making a large single array of the points but its size of struct{float x; float y;} x^10 elements and seems to cause problems on the GPU and CPU. Is there a way to perform this operation as I've shown but periodically because in between plotting to the window I want to compute the data on the GPU. Alternatively, are there other functions besides glutDisplayFunc(void(*func)(void)) to display pixels in the window?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.