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.
Hi @Sid Kraft .
I see the issue is an active compiler error C2084 stating that glutInit already has a body.
The error C2084 means that a function has been defined more than once. glutInit is already a built-in function provided by the OpenGL GLUT utility library. When you define void glutInit(int* argcp, char** argv) in your code, the compiler stops you because it sees two definitions for the exact same function.
To resolve this, you shouldn't create a custom function named glutInit. Instead, you should simply call the library's glutInit from within your main function (or create a custom function with a different name, like setupOpenGL) to initialize the window, like this:
void display(void)
{
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
glutInitWindowPosition(100, 200);
glutInitWindowSize(800, 700);
glutCreateWindow("This is a window title");
glutDisplayFunc(display);
glutIdleFunc(display);
glutMainLoop();
return 0;
}
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.
Let me know if you need anything else.
Thank you.