//OpenGL functions, open a window and initialize
void display(void)
{
glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glBegin(GL_LINES);
I = 0.;
do
{
glVertex3d(PLOTX[I], PLOTY[I], PLOTZ[I]);
glVertex3d(PLOTX[I + 1], PLOTY[I + 1], PLOTZ[I + 1]);
++I;
//output the values to the plot routines in OpenGL
cout << "Output of values to OpenGL Plot routines, I" << " " << PLOTX[I] << " " << PLOTY[I] << " " << PLOTZ[I] << " " << I << "\n";
cout << "Output of values to OpenGL Plot routines, I+1" << " " << PLOTX[I] << " " << PLOTY[I] << " " << PLOTZ[I] << " " << I + 1 << "\n";
} while (I <= INOW);
glEnd;
//glFlush();
}
//rename glutInit as one already in library, to eliminate "already has a body"
void initWindow(int* argcp, char** argv)
{
glutInit(argcp, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(100, 200);
glutInitWindowSize(800, 700);
glutCreateWindow("This is a window title");
glutDisplayFunc(display);
glutIdleFunc(display);
//glutMainLoop();
glFlush();
}
int main(int argcp, char** argv)
.
.
.
{
Running the above OpenGL sequence with graphics output to a window that was created with glutInit. Before I can view the output to the window, it immediately closes. How can I keep it open until finished in OpenGL and glutInit? Sid Kraft