OpenGL glutInit

Sid Kraft 76 Reputation points
2026-07-30T15:28:54.92+00:00
	void display(void);
	 {
		 glClearColor(1.0f, 0.0f, 0.0f, 1.0f); // Clear the background of our window to red  
		 glClear(GL_COLOR_BUFFER_BIT); //Clear the colour buffer (more buffers later on)  
		 glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations  

		 glFlush(); // Flush the OpenGL buffers to the window  
	 }
	  void glutInit(int* argcp, char** argv);
	 glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
	 glutInitWindowPosition(100, 200);

	 //this sets the size for the window
	 glutInitWindowSize(800, 700);

	 //create the window with a title
	 glutCreateWindow("This is a window title");
	 //this is the method that will have all the draw stuff.	
	 glutDisplayFunc(display);
	 glutIdleFunc(display);
	 glutMainLoop();
	 //issue the GL commands
	 glTranslatef(-.3, 0., 0.);
	 glRotated(ROT, XX, YY, ZZ);
	 glScalef(.01, .01, .01);

using the statements above directly from a glutInit tutorial and getting a linker error about the void display void being unresolved, not sure what the problem is, maybe someone can help, Sid Kraft

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.

0 comments No comments

1 answer

Sort by: Most helpful
  1. RLWA32 52,701 Reputation points
    2026-07-30T16:41:04.5+00:00
    	void display(void);
    	 {
    		 glClearColor(1.0f, 0.0f, 0.0f, 1.0f); // Clear the background of our window to red  
    		 glClear(GL_COLOR_BUFFER_BIT); //Clear the colour buffer (more buffers later on)  
    		 glLoadIdentity(); // Load the Identity Matrix to reset our drawing locations  
    
    		 glFlush(); // Flush the OpenGL buffers to the window  
    	 }
    

    Remove the semicolon at the end of void display(void);

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.