A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Hello @Sid Kraft ,
Thank you for providing the details and the code snippets.
In a typical GLUT application, drawing commands are generally executed within the designated display callback function whenever the window requires repainting. It might be beneficial to place your rendering loop inside the display function.
Additionally, it is possible that the points are not displaying because the glVertex3d calls are not enclosed within a glBegin() and glEnd() block. OpenGL requires this block to define what types of primitives you are trying to draw (such as GL_LINES or GL_LINE_STRIP).
I also noticed that the do-while loop does not seem to increment the index I. Adding I++ within the loop could help prevent the application from hanging indefinitely.
This suggests that updating your display function to include the state block, the loop, and the index increment might resolve the issue. Below is an example of what that could look like:
void display(void)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
// It might be helpful to specify the drawing mode, such as GL_LINES or GL_LINE_STRIP
glBegin(GL_LINES);
int I = 0;
// Assuming INOW, PLOTX, PLOTY, and PLOTZ are accessible within this scope
do
{
glVertex3d(PLOTX[I], PLOTY[I], PLOTZ[I]);
glVertex3d(PLOTX[I + 1], PLOTY[I + 1], PLOTZ[I + 1]);
I++; // Increment I to avoid an infinite loop
} while (I <= INOW);
glEnd();
glFlush();
}
Then, you can retain glutMainLoop(); at the very end of your main function (or the function where you initialize the window) to keep the window open and listening for events.
I hope this information is helpful. Please let me know if you see the output graphics after making these adjustments, or if I can assist you further. If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.