Hi,
First of all, I’m new at OpenGL/glut. I’m using C++ and GLUT to display 2D-meshes.
How can I update the display in order to show an iterative process? (I’m not really sure how to give a better explamation)
void screen(){ //displays all the edges, each defined by two nodes n1 and n2
...stuff...
glClear(GL_COLOR_BUFFER_BIT);
glLineWidth(2.0);
glBegin(GL_LINES);
...stuff...
glColor3f(1.0,0.5,0.0);
glVertex2d(n1[0],n1[1]);
glVertex2d(n2[0],n2[1]);
glEnd();
glFlush();
}
int main(int argc, char *argv[]){ //main function
...stuff...
for(int i=0;i<50;i++)
nodes.laplacian_smooth(edges,adjmat,tot_nodes); //This is my iterative process, it changes the coordinates of the nodes
glutInit(&argc, argv);
glutInitWindowSize(600,600);
glutInitWindowPosition(10,10);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutCreateWindow("LS");
scrset();
glutDisplayFunc(screen);
glutMainLoop();
return EXIT_SUCCESS;
}
Thanks.